this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cue: add more godoc links

I was looking at some of the deprecation notices
and it took me a bit of effort to find the referenced APIs.
Use godoc links so they are trivial to find.

While here, I noticed that hiddenValue.Value referenced a missing type,
which seems to have been a mistake when InstanceOrValue was added.

Also add a note to Instance about it being phased out,
which was documented in its constructors, but not the type itself.
We don't want to deprecate the type right away,
as it's still used in some of our user-facing APIs.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ibb1b7de6a1e4a27f4417158559d5857014d922c0
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171218
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+12 -10
+4 -6
cue/build.go
··· 102 102 // provided as a string, byte slice, or io.Reader. The name is used as the file 103 103 // name in position information. The source may import builtin packages. 104 104 // 105 - // Deprecated: use CompileString or CompileBytes. The use of Instance is being 106 - // phased out. 105 + // Deprecated: use [Context.CompileString] or [Context.CompileBytes]. 106 + // The use of [Instance] is being phased out. 107 107 func (r *hiddenRuntime) Parse(name string, source interface{}) (*Instance, error) { 108 108 return r.Compile(name, source) 109 109 } ··· 111 111 // Build creates an Instance from the given build.Instance. A returned Instance 112 112 // may be incomplete, in which case its Err field is set. 113 113 // 114 - // Deprecated: use Context.BuildInstance. The use of Instance is being phased 115 - // out. 114 + // Deprecated: use [Context.BuildInstance]. The use of [Instance] is being phased out. 116 115 func (r *hiddenRuntime) Build(p *build.Instance) (*Instance, error) { 117 116 v, _ := r.runtime().Build(nil, p) 118 117 return r.complete(p, v) 119 118 } 120 119 121 - // Deprecated: use cuecontext.Context.BuildInstances. The use of Instance is 122 - // being phased out. 120 + // Deprecated: [Context.BuildInstances]. The use of [Instance] is being phased out. 123 121 func Build(instances []*build.Instance) []*Instance { 124 122 if len(instances) == 0 { 125 123 panic("cue: list of instances must not be empty")
+6 -2
cue/instance.go
··· 24 24 "cuelang.org/go/internal/core/runtime" 25 25 ) 26 26 27 - // An InstanceOrValue is implemented by Value and *Instance. 27 + // An InstanceOrValue is implemented by [Value] and *[Instance]. 28 28 // 29 29 // This is a placeholder type that is used to allow Instance-based APIs to 30 30 // transition to Value-based APIs. The goals is to get rid of the Instance ··· 38 38 func (Value) internal() {} 39 39 func (*Instance) internal() {} 40 40 41 - // Value implements value.Instance. 41 + // Value implements [InstanceOrValue]. 42 42 func (v hiddenValue) Value() Value { return v } 43 43 44 44 // An Instance defines a single configuration based on a collection of 45 45 // underlying CUE files. 46 + // 47 + // Use of this type is being phased out in favor of [Value]. 48 + // Any APIs currently taking an Instance should use [InstanceOrValue] 49 + // to transition to the new type without breaking users. 46 50 type Instance struct { 47 51 index *runtime.Runtime 48 52
+2 -2
cue/types.go
··· 1055 1055 // split values may fail if actually unified. 1056 1056 // Source returns a non-nil value. 1057 1057 // 1058 - // Deprecated: use Expr. 1058 + // Deprecated: use [Value.Expr]. 1059 1059 func (v hiddenValue) Split() []Value { 1060 1060 if v.v == nil { 1061 1061 return nil ··· 1947 1947 // a reference. If a reference contains index selection (foo[bar]), it will 1948 1948 // only return a reference if the index resolves to a concrete value. 1949 1949 // 1950 - // Deprecated: use ReferencePath 1950 + // Deprecated: use [Value.ReferencePath] 1951 1951 func (v hiddenValue) Reference() (inst *Instance, path []string) { 1952 1952 root, p := v.ReferencePath() 1953 1953 if !root.Exists() {