From efe7b8a33d14d6910bc9f2c0bbfbdb83d7e31b78 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 24 Apr 2024 12:15:16 +0100 Subject: [PATCH 1/3] chore: fix some doc comments for daqgl to match Signed-off-by: Justin Chadwell --- dagql/objects.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dagql/objects.go b/dagql/objects.go index 2709b9ab4e2..1d4fd14b72f 100644 --- a/dagql/objects.go +++ b/dagql/objects.go @@ -221,7 +221,7 @@ func (o Instance[T]) Type() *ast.Type { var _ Object = Instance[Typed]{} -// ID returns the ID of the instance. +// ObjectType returns the ObjectType of the instance. func (r Instance[T]) ObjectType() ObjectType { return r.Class } @@ -238,7 +238,7 @@ type Wrapper interface { var _ Wrapper = Instance[Typed]{} -// Inner returns the inner value of the instance. +// Unwrap returns the inner value of the instance. func (r Instance[T]) Unwrap() Typed { return r.Self } @@ -583,15 +583,13 @@ func FormatDescription(paras ...string) string { return strings.Join(paras, "\n\n") } -// Doc sets the description of the field. Each argument is joined by two empty -// lines. func (field Field[T]) DynamicReturnType(ret Typed) Field[T] { field.Spec.Type = ret return field } -// Impure marks the field as "impure", meaning its result may change over time, -// or it has side effects. +// Deprecated marks the field as deprecated, meaning it should not be used by +// new code. func (field Field[T]) Deprecated(paras ...string) Field[T] { field.Spec.DeprecatedReason = FormatDescription(paras...) return field @@ -610,7 +608,7 @@ func (field Field[T]) Meta() Field[T] { return field } -// Definition returns the schema definition of the field. +// FieldDefinition returns the schema definition of the field. func (field Field[T]) FieldDefinition() *ast.FieldDefinition { spec := field.Spec if spec.Type == nil { From 16ef17390aa7079a2c6e758e26470c7b62e73d1a Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Wed, 24 Apr 2024 12:16:16 +0100 Subject: [PATCH 2/3] chore: remove some unused parameters And also enable a linter to catch these in the future. `unparam` seems to be optimized more heavily to avoid false positives, and is significantly better at not bringing up weird interface cases that revive seems to love. Signed-off-by: Justin Chadwell --- .golangci.yml | 19 ++++++++++++++++--- .../generator/go/templates/module_objects.go | 9 +++------ cmd/dagger/flags.go | 2 +- cmd/dagger/functions.go | 8 ++++---- core/container.go | 7 +++---- core/git.go | 8 +++----- core/integration/module_test.go | 2 +- core/interface.go | 6 +++--- core/modfunc.go | 1 - core/module.go | 1 - core/object.go | 4 +--- engine/buildkit/executor.go | 10 +++++----- engine/sources/blob/blobsource.go | 9 ++++++--- sdk/go/telemetry/batch_processor.go | 4 ++-- telemetry/inflight/batch_processor.go | 4 ++-- telemetry/labels_test.go | 2 +- telemetry/sdklog/batch_processor.go | 4 ++-- 17 files changed, 53 insertions(+), 47 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ab8f5179083..200e361a2f7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,21 +26,34 @@ linters: - typecheck - unconvert - unused + - unparam - whitespace issues: exclude-rules: - path: _test\.go linters: + # tests are very repetitive - dupl + # tests are allowed to do silly things - gosec + - path: docs/ + linters: + # example dagger module code might use extra ctx/err in signatures for clarity + - unparam + - text: ".* always receives .*" + linters: + # this is sometimes done for clarity + - unparam + linters-settings: revive: rules: - # This rule is annoying. Often you want to name the - # parameters for clarity because it conforms to an - # interface. + # This rule is annoying. Often you want to name the parameters for + # clarity because it conforms to an interface. Additionally, unparam + # finds a good number of cases for this anyways (with fewer false + # positives). - name: unused-parameter severity: warning disabled: true diff --git a/cmd/codegen/generator/go/templates/module_objects.go b/cmd/codegen/generator/go/templates/module_objects.go index e31d6139869..71b98c3d591 100644 --- a/cmd/codegen/generator/go/templates/module_objects.go +++ b/cmd/codegen/generator/go/templates/module_objects.go @@ -367,10 +367,7 @@ func (spec *parsedObjectType) marshalJSONMethodCode() (*Statement, error) { } concreteFields = append(concreteFields, fieldCode) - getFieldCode, err := spec.setFieldsToMarshalStructCode(field) - if err != nil { - return nil, fmt.Errorf("failed to generate get field code: %w", err) - } + getFieldCode := spec.setFieldsToMarshalStructCode(field) getFieldCodes = append(getFieldCodes, getFieldCode) } @@ -475,8 +472,8 @@ func (spec *parsedObjectType) setFieldsFromUnmarshalStructCode(field *fieldSpec) return s, nil } -func (spec *parsedObjectType) setFieldsToMarshalStructCode(field *fieldSpec) (*Statement, error) { - return Empty().Id("concrete").Dot(field.goName).Op("=").Id("r").Dot(field.goName), nil +func (spec *parsedObjectType) setFieldsToMarshalStructCode(field *fieldSpec) *Statement { + return Empty().Id("concrete").Dot(field.goName).Op("=").Id("r").Dot(field.goName) } type fieldSpec struct { diff --git a/cmd/dagger/flags.go b/cmd/dagger/flags.go index fd8c4bb79fe..c823445bcb5 100644 --- a/cmd/dagger/flags.go +++ b/cmd/dagger/flags.go @@ -594,7 +594,7 @@ func (v *moduleSourceValue) Get(ctx context.Context, dag *dagger.Client, _ *dagg // AddFlag adds a flag appropriate for the argument type. Should return a // pointer to the value. -func (r *modFunctionArg) AddFlag(flags *pflag.FlagSet, dag *dagger.Client) (any, error) { +func (r *modFunctionArg) AddFlag(flags *pflag.FlagSet) (any, error) { name := r.FlagName() usage := r.Description diff --git a/cmd/dagger/functions.go b/cmd/dagger/functions.go index 966928f50e8..280768adeb7 100644 --- a/cmd/dagger/functions.go +++ b/cmd/dagger/functions.go @@ -384,7 +384,7 @@ func (fc *FuncCommand) load(c *cobra.Command, a []string) (cmd *cobra.Command, _ if obj.Constructor != nil { // add constructor args as top-level flags - if err := fc.addArgsForFunction(c, a, obj.Constructor, dag); err != nil { + if err := fc.addArgsForFunction(c, a, obj.Constructor); err != nil { return nil, nil, err } fc.selectFunc(obj.Name, obj.Constructor, c, dag) @@ -454,7 +454,7 @@ func (fc *FuncCommand) makeSubCmd(dag *dagger.Client, fn *modFunction) *cobra.Co GroupID: funcGroup.ID, DisableFlagsInUseLine: true, PreRunE: func(cmd *cobra.Command, args []string) (err error) { - if err := fc.addArgsForFunction(cmd, args, fn, dag); err != nil { + if err := fc.addArgsForFunction(cmd, args, fn); err != nil { return err } @@ -542,7 +542,7 @@ func (fc *FuncCommand) makeSubCmd(dag *dagger.Client, fn *modFunction) *cobra.Co return newCmd } -func (fc *FuncCommand) addArgsForFunction(cmd *cobra.Command, cmdArgs []string, fn *modFunction, dag *dagger.Client) error { +func (fc *FuncCommand) addArgsForFunction(cmd *cobra.Command, cmdArgs []string, fn *modFunction) error { fc.mod.LoadTypeDef(fn.ReturnType) for _, arg := range fn.Args { @@ -550,7 +550,7 @@ func (fc *FuncCommand) addArgsForFunction(cmd *cobra.Command, cmdArgs []string, } for _, arg := range fn.Args { - _, err := arg.AddFlag(cmd.Flags(), dag) + _, err := arg.AddFlag(cmd.Flags()) if err != nil { return err } diff --git a/core/container.go b/core/container.go index a5263a9b8dd..07d5ed501b7 100644 --- a/core/container.go +++ b/core/container.go @@ -724,7 +724,7 @@ func (container *Container) WithSecretVariable(ctx context.Context, name string, } func (container *Container) Directory(ctx context.Context, dirPath string) (*Directory, error) { - dir, _, err := locatePath(ctx, container, dirPath, NewDirectory) + dir, _, err := locatePath(container, dirPath, NewDirectory) if err != nil { return nil, err } @@ -747,7 +747,7 @@ func (container *Container) Directory(ctx context.Context, dirPath string) (*Dir } func (container *Container) File(ctx context.Context, filePath string) (*File, error) { - file, _, err := locatePath(ctx, container, filePath, NewFile) + file, _, err := locatePath(container, filePath, NewFile) if err != nil { return nil, err } @@ -767,7 +767,6 @@ func (container *Container) File(ctx context.Context, filePath string) (*File, e } func locatePath[T *File | *Directory]( - ctx context.Context, container *Container, containerPath string, init func(*Query, *pb.Definition, string, Platform, ServiceBindings) T, @@ -929,7 +928,7 @@ func (container *Container) chown( } func (container *Container) writeToPath(ctx context.Context, subdir string, fn func(dir *Directory) (*Directory, error)) (*Container, error) { - dir, mount, err := locatePath(ctx, container, subdir, NewDirectory) + dir, mount, err := locatePath(container, subdir, NewDirectory) if err != nil { return nil, err } diff --git a/core/git.go b/core/git.go index 3317c13f583..4472ed7e4ae 100644 --- a/core/git.go +++ b/core/git.go @@ -8,7 +8,6 @@ import ( "github.com/vektah/gqlparser/v2/ast" "github.com/dagger/dagger/engine" - "github.com/dagger/dagger/engine/buildkit" "github.com/dagger/dagger/engine/sources/gitdns" ) @@ -59,8 +58,7 @@ func (*GitRef) TypeDescription() string { } func (ref *GitRef) Tree(ctx context.Context) (*Directory, error) { - bk := ref.Query.Buildkit - st, err := ref.getState(ctx, bk) + st, err := ref.getState(ctx) if err != nil { return nil, err } @@ -69,7 +67,7 @@ func (ref *GitRef) Tree(ctx context.Context) (*Directory, error) { func (ref *GitRef) Commit(ctx context.Context) (string, error) { bk := ref.Query.Buildkit - st, err := ref.getState(ctx, bk) + st, err := ref.getState(ctx) if err != nil { return "", err } @@ -83,7 +81,7 @@ func (ref *GitRef) Commit(ctx context.Context) (string, error) { return p.Sources.Git[0].Commit, nil } -func (ref *GitRef) getState(ctx context.Context, bk *buildkit.Client) (llb.State, error) { +func (ref *GitRef) getState(ctx context.Context) (llb.State, error) { opts := []llb.GitOption{} if ref.Repo.KeepGitDir { diff --git a/core/integration/module_test.go b/core/integration/module_test.go index b1ea971a8c4..b58befd4a2b 100644 --- a/core/integration/module_test.go +++ b/core/integration/module_test.go @@ -5817,7 +5817,7 @@ func hostDaggerCommand(ctx context.Context, t testing.TB, workdir string, args . } // runs a dagger cli command directly on the host, rather than in an exec -func hostDaggerExec(ctx context.Context, t testing.TB, workdir string, args ...string) ([]byte, error) { +func hostDaggerExec(ctx context.Context, t testing.TB, workdir string, args ...string) ([]byte, error) { //nolint: unparam t.Helper() cmd := hostDaggerCommand(ctx, t, workdir, args...) output, err := cmd.CombinedOutput() diff --git a/core/interface.go b/core/interface.go index 8cdca1ed137..fb751a82d57 100644 --- a/core/interface.go +++ b/core/interface.go @@ -252,7 +252,7 @@ func (iface *InterfaceType) Install(ctx context.Context, dag *dagql.Server) erro if err != nil { return nil, fmt.Errorf("failed to get object return type for %s.%s: %w", ifaceName, fieldDef.Name, err) } - return wrapIface(ctx, dag, ifaceReturnType, objReturnType, res) + return wrapIface(ifaceReturnType, objReturnType, res) }, }) } @@ -287,7 +287,7 @@ func (iface *InterfaceType) Install(ctx context.Context, dag *dagql.Server) erro return nil } -func wrapIface(ctx context.Context, dag *dagql.Server, ifaceType *InterfaceType, underlyingType ModType, res dagql.Typed) (dagql.Typed, error) { +func wrapIface(ifaceType *InterfaceType, underlyingType ModType, res dagql.Typed) (dagql.Typed, error) { switch underlyingType := underlyingType.(type) { case *InterfaceType, *ModuleObjectType: switch res := res.(type) { @@ -323,7 +323,7 @@ func wrapIface(ctx context.Context, dag *dagql.Server, ifaceType *InterfaceType, if ret.Elem == nil { // set the return type ret.Elem = item } - val, err := wrapIface(ctx, dag, ifaceType, underlyingType.Underlying, item) + val, err := wrapIface(ifaceType, underlyingType.Underlying, item) if err != nil { return nil, fmt.Errorf("failed to wrap item %d: %w", i, err) } diff --git a/core/modfunc.go b/core/modfunc.go index c75e539cbfe..c9f28c4120f 100644 --- a/core/modfunc.go +++ b/core/modfunc.go @@ -40,7 +40,6 @@ func newModFunction( ctx context.Context, root *Query, mod *Module, - modID *call.ID, objDef *ObjectTypeDef, runtime *Container, metadata *Function, diff --git a/core/module.go b/core/module.go index 3a84fb89a49..8fe321c0179 100644 --- a/core/module.go +++ b/core/module.go @@ -127,7 +127,6 @@ func (mod *Module) Initialize(ctx context.Context, oldSelf dagql.Instance[*Modul ctx, mod.Query, oldSelf.Self, - oldSelf.ID(), nil, mod.Runtime, NewFunction("", &TypeDef{ diff --git a/core/object.go b/core/object.go index 80a81ca6291..ce9baf219fe 100644 --- a/core/object.go +++ b/core/object.go @@ -110,7 +110,6 @@ func (t *ModuleObjectType) GetCallable(ctx context.Context, name string) (Callab ctx, mod.Query, mod, - mod.InstanceID, t.typeDef, mod.Runtime, fun, @@ -230,7 +229,7 @@ func (obj *ModuleObject) installConstructor(ctx context.Context, dag *dagql.Serv return fmt.Errorf("constructor function for object %s must return that object", objDef.OriginalName) } - fn, err := newModFunction(ctx, mod.Query, mod, mod.InstanceID, objDef, mod.Runtime, fnTypeDef) + fn, err := newModFunction(ctx, mod.Query, mod, objDef, mod.Runtime, fnTypeDef) if err != nil { return fmt.Errorf("failed to create function: %w", err) } @@ -323,7 +322,6 @@ func objFun(ctx context.Context, mod *Module, objDef *ObjectTypeDef, fun *Functi ctx, mod.Query, mod, - mod.InstanceID, objDef, mod.Runtime, fun, diff --git a/engine/buildkit/executor.go b/engine/buildkit/executor.go index b33115bcd16..85ed9d3f3b1 100644 --- a/engine/buildkit/executor.go +++ b/engine/buildkit/executor.go @@ -323,7 +323,7 @@ func (w *Worker) run( }) return err } - err = exitError(ctx, w.callWithIO(ctx, id, bundle, process, startedCallback, killer, runcCall)) + err = exitError(ctx, w.callWithIO(ctx, process, startedCallback, killer, runcCall)) if err != nil { w.runc.Delete(context.TODO(), id, &runc.DeleteOpts{}) return err @@ -405,18 +405,18 @@ func (w *Worker) Exec(ctx context.Context, id string, process executor.ProcessIn spec.Process.Env = process.Meta.Env } - err = w.exec(ctx, id, state.Bundle, spec.Process, process, nil) + err = w.exec(ctx, id, spec.Process, process, nil) return exitError(ctx, err) } -func (w *Worker) exec(ctx context.Context, id, bundle string, specsProcess *specs.Process, process executor.ProcessInfo, started func()) error { +func (w *Worker) exec(ctx context.Context, id string, specsProcess *specs.Process, process executor.ProcessInfo, started func()) error { killer, err := newExecProcKiller(w.runc, id) if err != nil { return fmt.Errorf("failed to initialize process killer: %w", err) } defer killer.Cleanup() - return w.callWithIO(ctx, id, bundle, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error { + return w.callWithIO(ctx, process, started, killer, func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error { return w.runc.Exec(ctx, id, *specsProcess, &runc.ExecOpts{ Started: started, IO: io, @@ -748,7 +748,7 @@ func handleSignals(ctx context.Context, runcProcess *procHandle, signals <-chan type runcCall func(ctx context.Context, started chan<- int, io runc.IO, pidfile string) error -func (w *Worker) callWithIO(ctx context.Context, id, bundle string, process executor.ProcessInfo, started func(), killer procKiller, call runcCall) error { +func (w *Worker) callWithIO(ctx context.Context, process executor.ProcessInfo, started func(), killer procKiller, call runcCall) error { runcProcess, ctx := runcProcessHandle(ctx, killer) defer runcProcess.Release() diff --git a/engine/sources/blob/blobsource.go b/engine/sources/blob/blobsource.go index b9fd668527b..27a2a89b79e 100644 --- a/engine/sources/blob/blobsource.go +++ b/engine/sources/blob/blobsource.go @@ -75,8 +75,11 @@ func IdentifierFromPB(op *pb.SourceOp) (*SourceIdentifier, error) { if !ok { return nil, fmt.Errorf("invalid blob source identifier %q", op.Identifier) } + if scheme != BlobScheme { + return nil, fmt.Errorf("invalid blob source identifier %q", op.Identifier) + } bs := &blobSource{} - return bs.identifier(scheme, ref, op.GetAttrs(), nil) + return bs.identifier(ref, op.GetAttrs(), nil) } func NewSource(opt Opt) (source.Source, error) { @@ -91,10 +94,10 @@ func (bs *blobSource) Schemes() []string { } func (bs *blobSource) Identifier(scheme, ref string, sourceAttrs map[string]string, p *pb.Platform) (source.Identifier, error) { - return bs.identifier(scheme, ref, sourceAttrs, p) + return bs.identifier(ref, sourceAttrs, p) } -func (bs *blobSource) identifier(scheme, ref string, sourceAttrs map[string]string, _ *pb.Platform) (*SourceIdentifier, error) { +func (bs *blobSource) identifier(ref string, sourceAttrs map[string]string, _ *pb.Platform) (*SourceIdentifier, error) { desc := ocispecs.Descriptor{ Digest: digest.Digest(ref), Annotations: map[string]string{}, diff --git a/sdk/go/telemetry/batch_processor.go b/sdk/go/telemetry/batch_processor.go index 1ed04abb8b5..f5c49a08dcb 100644 --- a/sdk/go/telemetry/batch_processor.go +++ b/sdk/go/telemetry/batch_processor.go @@ -410,7 +410,7 @@ func (bsp *batchSpanProcessor) enqueue(sd trace.ReadOnlySpan) { if bsp.o.BlockOnQueueFull { bsp.enqueueBlockOnQueueFull(ctx, sd) } else { - bsp.enqueueDrop(ctx, sd) + bsp.enqueueDrop(sd) } } @@ -427,7 +427,7 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd t } } -func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd trace.ReadOnlySpan) bool { +func (bsp *batchSpanProcessor) enqueueDrop(sd trace.ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } diff --git a/telemetry/inflight/batch_processor.go b/telemetry/inflight/batch_processor.go index 116bff64c91..867c9d60348 100644 --- a/telemetry/inflight/batch_processor.go +++ b/telemetry/inflight/batch_processor.go @@ -412,7 +412,7 @@ func (bsp *batchSpanProcessor) enqueue(sd trace.ReadOnlySpan) { if bsp.o.BlockOnQueueFull { bsp.enqueueBlockOnQueueFull(ctx, sd) } else { - bsp.enqueueDrop(ctx, sd) + bsp.enqueueDrop(sd) } } @@ -429,7 +429,7 @@ func (bsp *batchSpanProcessor) enqueueBlockOnQueueFull(ctx context.Context, sd t } } -func (bsp *batchSpanProcessor) enqueueDrop(ctx context.Context, sd trace.ReadOnlySpan) bool { +func (bsp *batchSpanProcessor) enqueueDrop(sd trace.ReadOnlySpan) bool { if !sd.SpanContext().IsSampled() { return false } diff --git a/telemetry/labels_test.go b/telemetry/labels_test.go index a84a90466ce..ef48d480d34 100644 --- a/telemetry/labels_test.go +++ b/telemetry/labels_test.go @@ -334,7 +334,7 @@ func TestLoadCircleCILabels(t *testing.T) { } } -func run(t *testing.T, exe string, args ...string) string { //nolint: unparam +func run(t *testing.T, exe string, args ...string) string { t.Helper() cmd := exec.Command(exe, args...) cmd.Stderr = os.Stderr diff --git a/telemetry/sdklog/batch_processor.go b/telemetry/sdklog/batch_processor.go index 29d5b80ed62..8184f430b7a 100644 --- a/telemetry/sdklog/batch_processor.go +++ b/telemetry/sdklog/batch_processor.go @@ -297,7 +297,7 @@ func (bsp *batchLogProcessor) enqueue(log *LogData) { if bsp.o.BlockOnQueueFull { bsp.enqueueBlockOnQueueFull(ctx, log) } else { - bsp.enqueueDrop(ctx, log) + bsp.enqueueDrop(log) } } @@ -310,7 +310,7 @@ func (bsp *batchLogProcessor) enqueueBlockOnQueueFull(ctx context.Context, log * } } -func (bsp *batchLogProcessor) enqueueDrop(ctx context.Context, log *LogData) bool { +func (bsp *batchLogProcessor) enqueueDrop(log *LogData) bool { select { case bsp.queue <- log: return true From 2d56a42a2895c905818ecbe7626d15deb5bae521 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Fri, 3 May 2024 11:22:05 +0100 Subject: [PATCH 3/3] fixups Signed-off-by: Justin Chadwell --- .github/dependabot.yml | 6 ------ .golangci.yml | 4 ++++ ci/docs.go | 19 +++++++++---------- ci/sdk_go.go | 2 +- ci/sdk_php.go | 2 +- ci/sdk_python.go | 2 +- ci/sdk_typescript.go | 2 +- core/modfunc.go | 1 - dagger.json | 2 +- 9 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 83a41b61cca..57f3c4281dd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -129,9 +129,3 @@ updates: applies-to: version-updates patterns: - "*" - - # ignore all npm dependencies in sdk/rust - - package-ecosystem: "npm" - directory: "/sdk/rust" - ignore: - - dependency-name: "*" diff --git a/.golangci.yml b/.golangci.yml index 200e361a2f7..158e8baacc3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,6 +46,10 @@ issues: # this is sometimes done for clarity - unparam + exclude-dirs: + # these files are already linted in sdk/go + - internal/telemetry + - internal/querybuilder linters-settings: revive: diff --git a/ci/docs.go b/ci/docs.go index 741ccb16931..fe4aab598c0 100644 --- a/ci/docs.go +++ b/ci/docs.go @@ -63,18 +63,17 @@ func (d Docs) Lint(ctx context.Context) error { // Regenerate the API schema and CLI reference docs func (d Docs) Generate(ctx context.Context) (*dagger.Directory, error) { eg, ctx := errgroup.WithContext(ctx) + _ = ctx var sdl *dagger.Directory eg.Go(func() error { - var err error - sdl, err = d.GenerateSdl(ctx) - return err + sdl = d.GenerateSdl() + return nil }) var cli *dagger.Directory eg.Go(func() error { - var err error - cli, err = d.GenerateCli(ctx) - return err + cli = d.GenerateCli() + return nil }) if err := eg.Wait(); err != nil { @@ -85,7 +84,7 @@ func (d Docs) Generate(ctx context.Context) (*dagger.Directory, error) { } // Regenerate the API schema -func (d Docs) GenerateSdl(ctx context.Context) (*Directory, error) { +func (d Docs) GenerateSdl() *Directory { introspectionJSON := util.GoBase(d.Dagger.Source). WithExec([]string{"go", "run", "./cmd/introspect"}, dagger.ContainerWithExecOpts{ @@ -100,14 +99,14 @@ func (d Docs) GenerateSdl(ctx context.Context) (*Directory, error) { WithExec([]string{"graphql-json-to-sdl", "/src/schema.json", "/src/schema.graphql"}). File("/src/schema.graphql") - return dag.Directory().WithFile(generatedSchemaPath, generated), nil + return dag.Directory().WithFile(generatedSchemaPath, generated) } // Regenerate the CLI reference docs -func (d Docs) GenerateCli(ctx context.Context) (*Directory, error) { +func (d Docs) GenerateCli() *Directory { // Should we keep `--include-experimental`? generated := util.GoBase(d.Dagger.Source). WithExec([]string{"go", "run", "./cmd/dagger", "gen", "--frontmatter=" + cliZenFrontmatter, "--output=cli.mdx", "--include-experimental"}). File("cli.mdx") - return dag.Directory().WithFile(generatedCliZenPath, generated), nil + return dag.Directory().WithFile(generatedCliZenPath, generated) } diff --git a/ci/sdk_go.go b/ci/sdk_go.go index 9e971e40801..28f39d96fd3 100644 --- a/ci/sdk_go.go +++ b/ci/sdk_go.go @@ -106,7 +106,7 @@ func (t GoSDK) Publish( } // Bump the Go SDK's Engine dependency -func (t GoSDK) Bump(ctx context.Context, version string) (*Directory, error) { +func (t GoSDK) Bump(version string) (*Directory, error) { // trim leading v from version version = strings.TrimPrefix(version, "v") diff --git a/ci/sdk_php.go b/ci/sdk_php.go index 3cef2feb7ab..139016c2579 100644 --- a/ci/sdk_php.go +++ b/ci/sdk_php.go @@ -83,7 +83,7 @@ func (t PHPSDK) Publish( } // Bump the PHP SDK's Engine dependency -func (t PHPSDK) Bump(ctx context.Context, version string) (*Directory, error) { +func (t PHPSDK) Bump(version string) (*Directory, error) { version = strings.TrimPrefix(version, "v") content := fmt.Sprintf(`