Skip to content

Simplify cue-related code - #107

Merged
shykes merged 2 commits into
mainfrom
cc
Feb 8, 2021
Merged

shykes merged 2 commits into
mainfrom
cc

Conversation

@shykes

@shykes shykes commented Feb 7, 2021 •

Copy link
Copy Markdown
Contributor
  • Simplify code by moving polyfill cue compiler to sub-package cc
  • Simplify op.go by removing unnecessary cue validations

NOTE: the sub-package is called cc to minimize breakage of existing code which had a variable cc := &Compiler{}. Since the name and interface are the same, the calls to methods of the cc variable become calls to functions of the cc package, and everything keeps working the same.

@aluzzardi aluzzardi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

nit: It would (subjectively) be cleaner to call this compiler. I can make a follow up PR if you agree (it's cheap to rename on vscode)

nit: net/http uses this same pattern (e.g. http.Get() is an "alias" for http.DefaultClient.Get(), DefaultClient being the equivalent of our global cc). You can use either the DefaultClient (by calling functions directly in the http package), or you can create your own Client instance. If we were to keep the embedded cc reference in Value, we could achieve the same (right now it's not possible because even if you create a new Compiler instance, Values would still reference the global). I can do that in a follow up if you agree.

Comment thread dagger/cc/cc.go
return errors.New(cueerrors.Details(err, &cueerrors.Config{}))
}

func Lock() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Now that the logic is self contained, can we get rid of those exposes lock functions? I don't think we're using them anywhere else

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense. Will do.

@shykes

shykes commented Feb 8, 2021

Copy link
Copy Markdown
Contributor Author

nit: It would (subjectively) be cleaner to call this compiler. I can make a follow up PR if you agree (it's cheap to rename on vscode)

nit: net/http uses this same pattern (e.g. http.Get() is an "alias" for http.DefaultClient.Get(), DefaultClient being the equivalent of our global cc). You can use either the DefaultClient (by calling functions directly in the http package), or you can create your own Client instance. If we were to keep the embedded cc reference in Value, we could achieve the same (right now it's not possible because even if you create a new Compiler instance, Values would still reference the global). I can do that in a follow up if you agree.

I have no opinion on either of these, so no issue with a follow-up PR.

@shykes
shykes merged commit 781b89e into main Feb 8, 2021
@aluzzardi
aluzzardi deleted the cc branch February 8, 2021 23:14
aluzzardi pushed a commit that referenced this pull request Sep 16, 2022
…ng.org/grpc-1.49.0

build(deps): bump google.golang.org/grpc from 1.48.0 to 1.49.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants