Conversation
DrJosh9000
reviewed
Feb 25, 2026
| Token: "bkaj_job-token", | ||
| } | ||
|
|
||
| jobWithMismatchedSecrets = api.Job{ |
Contributor
There was a problem hiding this comment.
This is unused? Should it be used?
DrJosh9000
reviewed
Feb 25, 2026
| func (m *multipartStreamer) WriteFile(key, artifactPath string, fh http.File) error { | ||
| if m.reader != nil { | ||
| return errors.New("WriteFile can't be called multiple times") | ||
| return errors.New("writeFile can't be called multiple times") |
Contributor
There was a problem hiding this comment.
WriteFile is referring to the method called WriteFile. Maybe the error should be rephrased:
Suggested change
| return errors.New("writeFile can't be called multiple times") | |
| return errors.New("file already written") |
DrJosh9000
reviewed
Feb 25, 2026
Comment on lines
+144
to
+147
| return nil, fmt.Errorf("%s your HTTP proxy settings do not grant a NO_PROXY=169.254.169.254 exemption for the instance metadata service, instance profile credentials may not be retrievable via your HTTP proxy", errorTitle) | ||
| } | ||
|
|
||
| return nil, fmt.Errorf("%s You can authenticate by setting Buildkite environment variables (BUILDKITE_S3_ACCESS_KEY_ID, BUILDKITE_S3_SECRET_ACCESS_KEY, BUILDKITE_S3_PROFILE), AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_PROFILE), Web Identity environment variables (AWS_ROLE_ARN, AWS_ROLE_SESSION_NAME, AWS_WEB_IDENTITY_TOKEN_FILE), or if running on AWS EC2 ensuring network access to the EC2 Instance Metadata Service to use an instance profile’s IAM Role credentials.", errorTitle) | ||
| return nil, fmt.Errorf("%s you can authenticate by setting Buildkite environment variables (BUILDKITE_S3_ACCESS_KEY_ID, BUILDKITE_S3_SECRET_ACCESS_KEY, BUILDKITE_S3_PROFILE), AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_PROFILE), Web Identity environment variables (AWS_ROLE_ARN, AWS_ROLE_SESSION_NAME, AWS_WEB_IDENTITY_TOKEN_FILE), or if running on AWS EC2 ensuring network access to the EC2 Instance Metadata Service to use an instance profile’s IAM Role credentials", errorTitle) |
Contributor
There was a problem hiding this comment.
This is another example complicated by errorTitle being the actual start of the error string, with the rest being "hint to the user".
What if we added an ErrorWithHint type that could be examined when the error is printed?
type ErrorWithHint struct {
Err error
Hint string
}
func (e ErrorWithHint) Unwrap() error { return e.Err }
func (e ErrorWithHint) Error() string { return e.Err.String() }
//...
if h := new(ErrorWithHint); errors.As(err, h) {
fmt.Fprintln(c.App.ErrWriter, h.Hint)
}
DrJosh9000
reviewed
Feb 25, 2026
| func (d S3Downloader) Start(ctx context.Context) error { | ||
| if d.conf.S3Client == nil { | ||
| return fmt.Errorf("S3Downloader for %s: S3Client is nil", d.conf.S3Path) | ||
| return fmt.Errorf("s3Downloader for %s: S3Client is nil", d.conf.S3Path) |
Contributor
There was a problem hiding this comment.
Again this is capitalised because it's referring to the type. Not sure what the best solution is here, but this seems wrong.
DrJosh9000
reviewed
Feb 25, 2026
| tempDir, err := filepath.EvalSymlinks(tempDirRaw) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("EvalSymlinks for temp dir: %w", err) | ||
| return nil, fmt.Errorf("evalSymlinks for temp dir: %w", err) |
Contributor
There was a problem hiding this comment.
Suggested change
| return nil, fmt.Errorf("evalSymlinks for temp dir: %w", err) | |
| return nil, fmt.Errorf("evaluating symlinks for temp dir: %w", err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
We've had golangci-lint as a soft-failing step in CI for a long time, and I think it's time we turned it on for real. However, we have a lot of code that's not up to scratch.
That's ok though! I threw $10 at the sourcegraph corporation and they did a perfectly adequate job of fixing all of our GCIL errors.
Changes
Close(),os.Remove(), logger/test writes,http.Serve()in goroutines, and similar best-effort operationsnet.Error.Temporary()call (timeout check already covers it)p.Plugin.DisplayName()→p.DisplayName()using promoted methodTesting
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go tool gofumpt -extra -w .)Disclosures / Credits
Look, none of this was me, it was all Amp, but i'm so glad for that.