Skip to content

Commit

Permalink
cue/build: remove context.Context field
Browse files Browse the repository at this point in the history
Despite remarks about cancellation, the context.Context
field isn't used. While we might add cancellation in the future,
that's easily done later, and for now this is somewhat misleading,
so remove the field and adjust the comment in question.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I5aa1380705bac1215b48a22d177f74639ea811e7
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/552266
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
  • Loading branch information
rogpeppe authored and mvdan committed Apr 6, 2023
1 parent 9422314 commit 1932295
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
7 changes: 1 addition & 6 deletions cue/build/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@
package build

import (
"context"

"cuelang.org/go/cue/ast"
)

// A Context keeps track of state of building instances and caches work.
type Context struct {
ctxt context.Context

loader LoadFunc
parseFunc func(str string, src interface{}) (*ast.File, error)

Expand Down Expand Up @@ -80,14 +76,13 @@ func (inst *Instance) Complete() error {
func (c *Context) init() {
if !c.initialized {
c.initialized = true
c.ctxt = context.Background()
c.imports = map[string]*Instance{}
}
}

// Options:
// - certain parse modes
// - parallellism
// - parallelism
// - error handler (allows cancelling the context)
// - file set.

Expand Down
3 changes: 0 additions & 3 deletions cue/load/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ type Config struct {
// packages at loading time.

// Context specifies the context for the load operation.
// If the context is cancelled, the loader may stop early
// and return an ErrCancelled error.
// If Context is nil, the load cannot be cancelled.
Context *build.Context

// A Module is a collection of packages and instances that are within the
Expand Down

0 comments on commit 1932295

Please sign in to comment.