Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update golangci-lint and fix various things #323

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '^1.22'
go-version: '^1.23'
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.1
version: v1.51.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a downgrade?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! yeah was meant to be the latest version, that's what I have on my machine. Thanks!

args: cli/... discern/... elan/... flair/... grpcutil/... lucidity/... mettle/... purity/... rexclient/... zeal/...
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
run:
timeout: 5m
skip-dirs:
- plz-out/
- tests/

issues:
exclude:
Expand All @@ -18,6 +15,9 @@ issues:
- unused-parameter # Quite a few of these, some legit, many are fulfilling interfaces
- redefines-builtin # Not really a big issue
- empty-block # Only came up once and was a false positive. This should be easily handled by review.
exclude-dirs:
- plz-out/
- tests/
exclude-rules:
- path: _test\.go
linters:
Expand All @@ -36,7 +36,7 @@ linters:
- bodyclose
- dogsled
- dupl
- exportloopref
- copyloopvar
- gocritic
- gofmt
- revive
Expand Down
2 changes: 0 additions & 2 deletions mettle/worker/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ func (w *worker) downloadAllFiles(files map[sdkdigest.Digest][]fileNode, packs m
g.Go(func() error { return w.downloadFiles(fileNodes) })
}
for dg, paths := range packs {
dg := dg
paths := paths
g.Go(func() error {
return w.downloadPack(dg, paths)
})
Expand Down
14 changes: 10 additions & 4 deletions mettle/worker/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,21 @@ func (w *worker) checkLiveConnection() bool {
func (w *worker) checkConnectivity(check string) {
switch check {
case "gstatic":
if resp, err := http.Get("https://connectivitycheck.gstatic.com/generate_204"); err != nil {
resp, err := http.Get("https://connectivitycheck.gstatic.com/generate_204")
if err != nil {
log.Fatalf("Failed to complete connectivity check: %s", err)
} else if resp.StatusCode != http.StatusNoContent {
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusNoContent {
log.Fatalf("Connectivity check returned unexpected status: %s", resp.Status)
}
case "firefox":
if resp, err := http.Get("https://detectportal.firefox.com/canonical.html"); err != nil {
resp, err := http.Get("https://detectportal.firefox.com/canonical.html")
if err != nil {
log.Fatalf("Failed to complete connectivity check: %s", err)
} else if resp.StatusCode != http.StatusOK {
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
log.Fatalf("Connectivity check returned unexpected status: %s", resp.Status)
}
case "":
Expand Down
8 changes: 4 additions & 4 deletions mettle/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func runForever(instanceName, requestQueue, responseQueue, name, storage, dir, c
// our queues or something else bad happened internally so we are basically doomed
// and should stop.
err = fmt.Errorf("Failed to run task: %s", err)
w.Report(false, false, false, err.Error())
w.Report(false, false, false, "%s", err)
return err
}
}
Expand Down Expand Up @@ -533,7 +533,7 @@ func (w *worker) runTask(msg *pubsub.Message) *pb.ExecuteResponse {

// forceShutdown sends any shutdown reports and calls log.Fatal() to shut down the worker
func (w *worker) forceShutdown(shutdownMsg string) {
w.Report(false, false, false, shutdownMsg)
w.Report(false, false, false, "%s", shutdownMsg)
log.Info("Force shutting down worker")
if w.currentMsg != nil {
if w.actionDigest != nil {
Expand Down Expand Up @@ -901,7 +901,7 @@ func (w *worker) writeUncachedResult(ar *pb.ActionResult, msg string) string {
b, _ := proto.Marshal(&bbcas.UncachedActionResult{
ActionDigest: w.actionDigest,
ExecuteResponse: &pb.ExecuteResponse{
Status: status(nil, codes.Unknown, msg),
Status: status(nil, codes.Unknown, "%s", msg),
Result: ar,
},
})
Expand Down Expand Up @@ -1075,7 +1075,7 @@ func (w *worker) collectOutputs(ar *pb.ActionResult, cmd *pb.Command) error {

// update sends an update on the response channel
func (w *worker) update(stage pb.ExecutionStage_Value, response *pb.ExecuteResponse) error {
w.Report(true, stage == pb.ExecutionStage_EXECUTING, true, stage.String())
w.Report(true, stage == pb.ExecutionStage_EXECUTING, true, "%s", stage)
body := common.MarshalOperation(stage, w.actionDigest, response, w.metadata)
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
Expand Down
Loading