Skip to content

Commit

Permalink
go.mod,Earthfile: bump things
Browse files Browse the repository at this point in the history
Also ensure that we startup a versioncontrol server as well,
that way we don't rely on what the public version is.

Change-Id: I919cbfd0cae809873b2d1499952020879594bade
  • Loading branch information
egonelbre committed May 9, 2024
1 parent 0605f86 commit 150ae30
Show file tree
Hide file tree
Showing 17 changed files with 455 additions and 594 deletions.
43 changes: 32 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ run:
issues-exit-code: 1
tests: true

skip-files:
- ".*\\.pb\\.go$"
- ".*\\.dbx\\.go$"


linters:
enable:
- bidichk # find dangerous bidi unicode symbols
Expand All @@ -30,9 +25,7 @@ linters:
- nakedret # check for naked returns
- nilerr # checks for misuses of `if err != nil { return nil }`
- noctx # finds locations that should use context
- nolintlint # checks that nolint directives are correct
- revive # check standard linting rules
- staticcheck # comprehensive checks
- tenv # ensure we use t.SetEnv instead of os.SetEnv
- unconvert # remove unnecessary conversions
- wastedassign
Expand All @@ -46,6 +39,8 @@ linters:
#TODO#- unparam # check for unused parameters
#TODO#- whitespace # checks for leading/trailing newlines
disable:
- nolintlint # checks that nolint directives are correct
- staticcheck # we already use staticcheck separately
- asciicheck # non-ascii is allowed
- containedctx # gives false positives, however might be good to re-evaluate
- contextcheck # doesn't look like it's useful
Expand Down Expand Up @@ -98,7 +93,8 @@ linters:
fast: false

output:
format: colored-line-number
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true

Expand Down Expand Up @@ -175,13 +171,38 @@ issues:
new: false
exclude-use-default: false

exclude-files:
- ".*\\.pb\\.go$"
- ".*\\.dbx\\.go$"

exclude-rules:
- linters:
- goerr113
text: "do not define dynamic errors"
- linters:
- linters: # uninteresting, it would be nice to be consistent, but we don't want to block the build for it
- revive
text: "if-return"
- linters: # false-positives for c exports
- linters: # a lot of false-positives for c exports
- revive
text: "var-naming"
- linters: # uninteresting, error doesn't need to be the last type
- revive
text: "error-return"
- linters: # uninteresting, ideally we would have this on, but we need to fix all the packages first
- revive
text: "package-comments"
- linters: # uninteresting, it would be nice to be consistent, but we don't want to block the build for it
- revive
text: "superfluous-else"
- linters: # uninteresting, it would be nice to be consistent, but we don't want to block the build for it
- revive
text: "indent-error-flow"
- linters: # uninteresting, it's common to leave args unused
- revive
text: "unused-parameter"
- linters: # false positives, see https://github.com/mgechev/revive/issues/810
- revive
text: "empty-block"
- linters: # uninteresting, it's fine to redefine builtins
- revive
text: "var-naming"
text: "redefines-builtin-id"
21 changes: 11 additions & 10 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
VERSION 0.6
FROM golang:1.19
VERSION 0.8
FROM golang:1.22.2
WORKDIR /go/storj-up

lint-deps:
RUN go install github.com/storj/ci/...@5286f52
RUN go install honnef.co/go/tools/cmd/staticcheck@2022.1.3
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3
RUN go install github.com/storj/ci/...@250909cd2ce8b5da02058386cc3d9eeac4dd67e7
RUN go install honnef.co/go/tools/cmd/staticcheck@2023.1.7
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2

lint:
FROM +lint-deps
Expand Down Expand Up @@ -42,11 +42,12 @@ build-app:
test:
RUN go install github.com/mfridman/tparse@36f80740879e24ba6695649290a240c5908ffcbb
RUN apt-get update && apt-get install -y jq
RUN go install storj.io/storj/cmd/[email protected]
RUN go install storj.io/storj/cmd/[email protected]
RUN go install storj.io/gateway-mt/cmd/[email protected]
RUN go install storj.io/gateway-mt/cmd/[email protected]
RUN go install storj.io/gateway-mt/cmd/[email protected]
RUN go install storj.io/storj/cmd/[email protected]
RUN go install storj.io/storj/cmd/[email protected]
RUN go install storj.io/storj/cmd/[email protected]
RUN go install storj.io/edge/cmd/[email protected]
RUN go install storj.io/edge/cmd/[email protected]
RUN go install storj.io/edge/cmd/[email protected]
RUN mkdir build
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand Down
7 changes: 3 additions & 4 deletions cmd/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import (
"encoding/base32"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"net/url"
"os"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -135,8 +133,9 @@ func init() {
}

func executeWithRetry(ctx context.Context, f func(ctx context.Context) error) error {
var err error
for i := 0; i < retry; i++ {
err := f(ctx)
err = f(ctx)
if err == nil {
return nil
}
Expand All @@ -145,7 +144,7 @@ func executeWithRetry(ctx context.Context, f func(ctx context.Context) error) er
}
time.Sleep(1 * time.Second)
}
return errors.New("Failed after " + strconv.Itoa(retry) + " retries")
return errs.Errorf("Failed after %v retries. Last error: %w", retry, err)
}

func attemptUpdateDockerHost() error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"storj.io/storj/satellite/accounting"
"storj.io/storj/satellite/buckets"
"storj.io/storj/satellite/compensation"
"storj.io/storj/satellite/overlay"
"storj.io/storj/satellite/nodeselection"
"storj.io/storj/satellite/satellitedb"
)

Expand Down Expand Up @@ -199,7 +199,7 @@ func generatePayments(database string) error {
Month: oneMonthBefore.Month(),
}

err = db.OverlayCache().IterateAllContactedNodes(ctx, func(ctx context.Context, node *overlay.SelectedNode) error {
err = db.OverlayCache().IterateAllContactedNodes(ctx, func(ctx context.Context, node *nodeselection.SelectedNode) error {
storedDataGB := rand.Intn(1000) + 400
getUsage := int64(storedDataGB * 10 / 7)
paystub := compensation.Paystub{
Expand Down
Loading

0 comments on commit 150ae30

Please sign in to comment.