diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 128e0bae8c5..b705d804914 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -70,7 +70,7 @@ jobs: uses: golangci/golangci-lint-action@v6 with: skip-cache: false - version: v1.61.0 + version: v1.64.5 - name: Whitespace check run: make check-whitespace - name: go mod tidy check @@ -88,7 +88,7 @@ jobs: cache: false go-version-file: go.mod - name: Cache Go Modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cache/go-build @@ -97,7 +97,7 @@ jobs: - name: Test with code coverage run: make cover=1 test-ci - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true diff --git a/Dockerfile b/Dockerfile index 0989384d42c..0850b2ed8cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23 AS build +FROM golang:1.24 AS build WORKDIR /src # enable modules caching in separate layer @@ -8,12 +8,12 @@ COPY . ./ RUN make binary -FROM debian:12.7-slim +FROM debian:12.10-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates; \ + ca-certificates; \ apt-get clean; \ rm -rf /var/lib/apt/lists/*; \ groupadd -r bee --gid 999; \ diff --git a/Dockerfile.dev b/Dockerfile.dev index 1e4c0082809..a417c710cbc 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM golang:1.23 AS build +FROM golang:1.24 AS build ARG REACHABILITY_OVERRIDE_PUBLIC=false ARG BATCHFACTOR_OVERRIDE_PUBLIC=5 @@ -13,7 +13,7 @@ RUN make binary \ REACHABILITY_OVERRIDE_PUBLIC=${REACHABILITY_OVERRIDE_PUBLIC} \ BATCHFACTOR_OVERRIDE_PUBLIC=${BATCHFACTOR_OVERRIDE_PUBLIC} -FROM debian:12.7-slim +FROM debian:12.10-slim ENV DEBIAN_FRONTEND=noninteractive diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 0ba724a0df7..2a62048228e 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -1,9 +1,9 @@ -FROM debian:12.7-slim +FROM debian:12.10-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates; \ + ca-certificates; \ apt-get clean; \ rm -rf /var/lib/apt/lists/*; \ groupadd -r bee --gid 999; \ diff --git a/Dockerfile.scratch b/Dockerfile.scratch index 182a92aa284..e11761aa326 100644 --- a/Dockerfile.scratch +++ b/Dockerfile.scratch @@ -1,9 +1,9 @@ -FROM debian:12.7-slim +FROM debian:12.10-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates; \ + ca-certificates; \ groupadd -r bee --gid 999; \ useradd -r -g bee --uid 999 --no-log-init -m bee; diff --git a/Makefile b/Makefile index c0611ed8ccd..01568f1136b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GO ?= go GOBIN ?= $$($(GO) env GOPATH)/bin GOLANGCI_LINT ?= $(GOBIN)/golangci-lint -GOLANGCI_LINT_VERSION ?= v1.61.0 +GOLANGCI_LINT_VERSION ?= v1.64.5 GOGOPROTOBUF ?= protoc-gen-gogofaster GOGOPROTOBUF_VERSION ?= v1.3.1 BEEKEEPER_INSTALL_DIR ?= $(GOBIN) diff --git a/go.mod b/go.mod index c90671a9bd4..9f24c169ea0 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/ethersphere/bee/v2 -go 1.23 - -toolchain go1.23.0 +go 1.24 require ( contrib.go.opencensus.io/exporter/prometheus v0.4.2 @@ -56,28 +54,6 @@ require ( resenje.org/web v0.4.3 ) -require ( - github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/pion/datachannel v1.5.10 // indirect - github.com/pion/dtls/v2 v2.2.12 // indirect - github.com/pion/ice/v2 v2.3.37 // indirect - github.com/pion/interceptor v0.1.37 // indirect - github.com/pion/logging v0.2.2 // indirect - github.com/pion/mdns v0.0.12 // indirect - github.com/pion/randutil v0.1.0 // indirect - github.com/pion/rtcp v1.2.15 // indirect - github.com/pion/rtp v1.8.10 // indirect - github.com/pion/sctp v1.8.35 // indirect - github.com/pion/sdp/v3 v3.0.9 // indirect - github.com/pion/srtp/v2 v2.0.20 // indirect - github.com/pion/stun v0.6.1 // indirect - github.com/pion/transport/v2 v2.2.10 // indirect - github.com/pion/transport/v3 v3.0.7 // indirect - github.com/pion/turn/v2 v2.1.6 // indirect - github.com/pion/webrtc/v3 v3.3.5 // indirect - github.com/wlynxg/anet v0.0.5 // indirect -) - require ( github.com/BurntSushi/toml v1.1.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -109,6 +85,7 @@ require ( github.com/go-ole/go-ole v1.3.0 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect @@ -156,6 +133,23 @@ require ( github.com/opencontainers/runtime-spec v1.2.0 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/pelletier/go-toml v1.8.0 // indirect + github.com/pion/datachannel v1.5.10 // indirect + github.com/pion/dtls/v2 v2.2.12 // indirect + github.com/pion/ice/v2 v2.3.37 // indirect + github.com/pion/interceptor v0.1.37 // indirect + github.com/pion/logging v0.2.2 // indirect + github.com/pion/mdns v0.0.12 // indirect + github.com/pion/randutil v0.1.0 // indirect + github.com/pion/rtcp v1.2.15 // indirect + github.com/pion/rtp v1.8.10 // indirect + github.com/pion/sctp v1.8.35 // indirect + github.com/pion/sdp/v3 v3.0.9 // indirect + github.com/pion/srtp/v2 v2.0.20 // indirect + github.com/pion/stun v0.6.1 // indirect + github.com/pion/transport/v2 v2.2.10 // indirect + github.com/pion/transport/v3 v3.0.7 // indirect + github.com/pion/turn/v2 v2.1.6 // indirect + github.com/pion/webrtc/v3 v3.3.5 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -179,6 +173,7 @@ require ( github.com/uber/jaeger-lib v2.2.0+incompatible // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/wealdtech/go-multicodec v1.4.0 // indirect + github.com/wlynxg/anet v0.0.5 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.23.0 // indirect diff --git a/pkg/api/dirs_test.go b/pkg/api/dirs_test.go index 2aff865320f..bcf4f1ea1c5 100644 --- a/pkg/api/dirs_test.go +++ b/pkg/api/dirs_test.go @@ -49,7 +49,7 @@ func TestDirs(t *testing.T) { jsonhttptest.WithRequestBody(bytes.NewReader(nil)), jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"), jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ - Message: api.InvalidRequest.Error(), + Message: api.ErrInvalidRequest.Error(), Code: http.StatusBadRequest, }), jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar), @@ -66,7 +66,7 @@ func TestDirs(t *testing.T) { jsonhttptest.WithRequestBody(file), jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"), jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ - Message: api.DirectoryStoreError.Error(), + Message: api.ErrDirectoryStoreError.Error(), Code: http.StatusInternalServerError, }), jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar), @@ -86,7 +86,7 @@ func TestDirs(t *testing.T) { jsonhttptest.WithRequestBody(tarReader), jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "True"), jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ - Message: api.InvalidContentType.Error(), + Message: api.ErrInvalidContentType.Error(), Code: http.StatusBadRequest, }), jsonhttptest.WithRequestHeader(api.ContentTypeHeader, "other"), @@ -372,7 +372,6 @@ func TestDirs(t *testing.T) { // check error document validateAltPath(t, "_non_existent_file_path_", errorDocumentPath) } - } t.Run(tc.name, func(t *testing.T) { t.Run("tar_upload", func(t *testing.T) { @@ -520,7 +519,7 @@ func TestDirsEmtpyDir(t *testing.T) { jsonhttptest.WithRequestHeader(api.SwarmCollectionHeader, "true"), jsonhttptest.WithRequestHeader(api.ContentTypeHeader, api.ContentTypeTar), jsonhttptest.WithExpectedJSONResponse(jsonhttp.StatusResponse{ - Message: api.EmptyDir.Error(), + Message: api.ErrEmptyDir.Error(), Code: http.StatusBadRequest, }), ) @@ -543,7 +542,7 @@ func tarFiles(t *testing.T, files []f) *bytes.Buffer { // create tar header and write it hdr := &tar.Header{ Name: filePath, - Mode: 0600, + Mode: 0o600, Size: int64(len(file.data)), } if err := tw.WriteHeader(hdr); err != nil { @@ -572,7 +571,7 @@ func tarEmptyDir(t *testing.T) *bytes.Buffer { hdr := &tar.Header{ Name: "empty/", - Mode: 0600, + Mode: 0o600, } if err := tw.WriteHeader(hdr); err != nil { @@ -605,11 +604,9 @@ func multipartFiles(t *testing.T, files []f) (*bytes.Buffer, string) { contentType := file.header.Get(api.ContentTypeHeader) if contentType != "" { hdr.Set(api.ContentTypeHeader, contentType) - } if len(file.data) > 0 { hdr.Set(api.ContentLengthHeader, strconv.Itoa(len(file.data))) - } part, err := mw.CreatePart(hdr) if err != nil { diff --git a/pkg/api/export_test.go b/pkg/api/export_test.go index 8349beb8e90..1e5e8f1554f 100644 --- a/pkg/api/export_test.go +++ b/pkg/api/export_test.go @@ -21,15 +21,13 @@ type ( ) var ( - InvalidContentType = errInvalidContentType - InvalidRequest = errInvalidRequest - DirectoryStoreError = errDirectoryStore - EmptyDir = errEmptyDir + ErrInvalidContentType = errInvalidContentType + ErrInvalidRequest = errInvalidRequest + ErrDirectoryStoreError = errDirectoryStore + ErrEmptyDir = errEmptyDir ) -var ( - ContentTypeTar = contentTypeTar -) +var ContentTypeTar = contentTypeTar var ( ErrNoResolver = errNoResolver @@ -138,6 +136,7 @@ type HexInvalidByteError = hexInvalidByteError func MapStructure(input, output interface{}, hooks map[string]func(v string) (string, error)) error { return mapStructure(input, output, hooks) } + func NewParseError(entry, value string, cause error) error { return newParseError(entry, value, cause) }