diff --git a/cmd/builder/go.mod b/cmd/builder/go.mod index 1e976504061..80833df3de4 100644 --- a/cmd/builder/go.mod +++ b/cmd/builder/go.mod @@ -18,6 +18,7 @@ require ( go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 + golang.org/x/mod v0.14.0 ) require ( @@ -31,7 +32,6 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect - golang.org/x/mod v0.14.0 // indirect golang.org/x/sys v0.14.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/cmd/builder/internal/builder/main.go b/cmd/builder/internal/builder/main.go index 54108f016dd..acf888a9d84 100644 --- a/cmd/builder/internal/builder/main.go +++ b/cmd/builder/internal/builder/main.go @@ -15,10 +15,11 @@ import ( "text/template" "time" - "go.opentelemetry.io/collector/cmd/builder/internal/builder/modfile" "go.uber.org/zap" "go.uber.org/zap/zapio" "golang.org/x/mod/semver" + + "go.opentelemetry.io/collector/cmd/builder/internal/builder/modfile" ) var ( diff --git a/cmd/builder/internal/builder/main_test.go b/cmd/builder/internal/builder/main_test.go index e06031f08fe..3d6a9a9631f 100644 --- a/cmd/builder/internal/builder/main_test.go +++ b/cmd/builder/internal/builder/main_test.go @@ -181,6 +181,9 @@ func makeModule(dir string) error { return fmt.Errorf("failed to create output path: %w", err) } - os.WriteFile(filepath.Clean(filepath.Join(dir, "go.mod")), []byte(goModTestFile), 0644) + err := os.WriteFile(filepath.Clean(filepath.Join(dir, "go.mod")), []byte(goModTestFile), 0600) + if err != nil { + return fmt.Errorf("failed to write go.mod file: %w", err) + } return nil }