Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Oct 8, 2024
1 parent 1fbd461 commit 927060a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/controller/admin/local_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s *diskSchemaRetriever) GetActiveSchema(ctx context.Context) (*schema.Sche
if err != nil {
moduleSchemas <- either.RightOf[*schema.Module](fmt.Errorf("could not load plugin for %s: %w", m.Module, err))
}
defer plugin.Kill(ctx)
defer plugin.Kill(ctx) // nolint:errcheck

customDefaults, err := plugin.ModuleConfigDefaults(ctx, m.Dir)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion frontend/cli/cmd_schema_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func localSchema(ctx context.Context, projectConfig projectconfig.Config) (*sche
if err != nil {
moduleSchemas <- either.RightOf[*schema.Module](m)
}
defer plugin.Kill(ctx)
defer plugin.Kill(ctx) // nolint:errcheck

customDefaults, err := plugin.ModuleConfigDefaults(ctx, m.Dir)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion go-runtime/compile/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,11 @@ func writeSchemaErrors(config moduleconfig.AbsModuleConfig, errors []builderrors
if err != nil {
return fmt.Errorf("failed to marshal errors: %w", err)
}
return os.WriteFile(config.Errors, elBytes, 0600)
err = os.WriteFile(config.Errors, elBytes, 0600)
if err != nil {
return fmt.Errorf("could not write build errors: %w", err)
}
return nil
}

// returns the import path and directory name for a Go type
Expand Down
4 changes: 2 additions & 2 deletions internal/buildengine/languageplugin/go_plugin_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func replacementWatches(moduleDir, deployDir string) ([]string, error) {
if strings.HasPrefix(r.New.Path, ".") {
relPath, err := filepath.Rel(filepath.Dir(goModPath), filepath.Join(filepath.Dir(goModPath), r.New.Path))
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to get relative path for %s: %w", r.New.Path, err)
}
replacements[r.Old.Path] = relPath
}
Expand Down Expand Up @@ -111,7 +111,7 @@ func parseImports(filePath string) ([]string, error) {
fset := token.NewFileSet()
file, err := parser.ParseFile(fset, filePath, nil, parser.ImportsOnly)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to parse imports in %s: %w", filePath, err)
}

var imports []string
Expand Down
1 change: 1 addition & 0 deletions internal/buildengine/languageplugin/go_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestExtractModuleDepsGo(t *testing.T) {
}

func TestGoConfigDefaults(t *testing.T) {
t.Parallel()
for _, tt := range []struct {
dir string
expected moduleconfig.CustomDefaults
Expand Down
1 change: 1 addition & 0 deletions internal/buildengine/languageplugin/java_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestExtractModuleDepsKotlin(t *testing.T) {
}

func TestJavaConfigDefaults(t *testing.T) {
t.Parallel()
watch := []string{
"pom.xml",
"src/**",
Expand Down
2 changes: 1 addition & 1 deletion internal/moduleconfig/moduleconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c ModuleConfig) Abs() AbsModuleConfig {
return AbsModuleConfig(clone)
}

// configureDefaults defaults sets values for empty fields and validates the config.
// FillDefaultsAndValidate sets values for empty fields and validates the config.
// It involves standard defaults for Real and Errors fields, and also looks at CustomDefaults for
// defaulting other fields.
func (c UnvalidatedModuleConfig) FillDefaultsAndValidate(customDefaults CustomDefaults) (ModuleConfig, error) {
Expand Down
1 change: 1 addition & 0 deletions internal/moduleconfig/moduleconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

func TestDefaulting(t *testing.T) {
t.Parallel()
for _, tt := range []struct {
config UnvalidatedModuleConfig
defaults CustomDefaults
Expand Down

0 comments on commit 927060a

Please sign in to comment.