Skip to content

Commit

Permalink
- upgrade to go 1.22
Browse files Browse the repository at this point in the history
- upgrade dependencies
- use the linter from go-ethereum
- upgrade ten hardhat plugin
  • Loading branch information
tudor-malene committed Mar 19, 2024
1 parent a38b4ab commit a486384
Show file tree
Hide file tree
Showing 21 changed files with 355 additions and 639 deletions.
124 changes: 48 additions & 76 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,60 @@
# This file configures github.com/golangci/golangci-lint.

run:
skip-dirs:
- design
- docs
timeout: 20m
tests: true
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
skip-files:
- core/genesis_alloc.go

linters:
# Disable all linters.
# Default: false
disable-all: true
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default-linters
enable:
- asciicheck
- bidichk
- bodyclose
- contextcheck
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- gochecknoinits
- gocognit
- goconst
- gocyclo
- gofmt
- gofumpt # https://github.com/mvdan/gofumpt#gofumpt -> gofumpt -l -w .
- goheader
- goimports
- revive
#- gomoddirectives It complains with docker import fix
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- noctx
- nolintlint
- prealloc
- predeclared
- promlinter
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- stylecheck
- tagliatelle
- tenv
- tparallel
- typecheck
- unconvert
- unparam
- typecheck
- unused
- wastedassign
- staticcheck
- bidichk
- durationcheck
- exportloopref
- whitespace
# - cyclop Would be nice to enable this
# - wrapcheck Helpful to add error tracing
# - varnamelen Handy to enforce much better readability
# - wsl would be nice to turn this on
# - forcetypeassert Usually good to enable
# - gocritic Would be nice to enabled this in the future
# - gochecknoglobals Should enable this at some stage too
# - godot
# - godox
# - goerr113
# - testpackage
# - thelper
# - nlreturn
# - paralleltest
# - interfacer
# - ireturn
# - lll
# - gomnd
# - exhaustivestruct
# - forbidigo
# - funlen
# - gci

# - structcheck # lots of false positives
# - errcheck #lot of false positives
# - contextcheck
# - errchkjson # lots of false positives
# - errorlint # this check crashes
# - exhaustive # silly check
# - makezero # false positives
# - nilerr # several intentional

linters-settings:
gofmt:
simplify: true

issues:
exclude-rules:
- path: crypto/bn256/cloudflare/optate.go
linters:
- deadcode
- staticcheck
- path: internal/build/pgp.go
text: 'SA1019: "golang.org/x/crypto/openpgp" is deprecated: this package is unmaintained except for security fixes.'
- path: core/vm/contracts.go
text: 'SA1019: "golang.org/x/crypto/ripemd160" is deprecated: RIPEMD-160 is a legacy hash and should not be used for new applications.'
- path: accounts/usbwallet/trezor.go
text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.'
- path: accounts/usbwallet/trezor/
text: 'SA1019: "github.com/golang/protobuf/proto" is deprecated: Use the "google.golang.org/protobuf/proto" package instead.'
exclude:
- 'SA1019: event.TypeMux is deprecated: use Feed'
- 'SA1019: strings.Title is deprecated'
- 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- 'SA1029: should not use built-in type string as key for value'
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
"@openzeppelin/contracts-upgradeable": "^5.0.1",
"ethers": "^6.6.0",
"hardhat-ignore-warnings": "^0.2.6",
"ten-hardhat-plugin": "^0.0.8"
"ten-hardhat-plugin": "^0.0.9"
}
}
4 changes: 2 additions & 2 deletions dockerfiles/enclave.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Defaults to restricted flag mode
ARG TESTMODE=false

FROM ghcr.io/edgelesssys/ego-dev:v1.3.0 AS build-base
FROM ghcr.io/edgelesssys/ego-dev:v1.5.0 AS build-base

# setup container data structure
RUN mkdir -p /home/obscuro/go-obscuro
Expand Down Expand Up @@ -48,7 +48,7 @@ RUN ego sign enclave-test.json
FROM build-enclave-testmode-${TESTMODE} as build-enclave

# Trigger a new build stage and use the smaller ego version:
FROM ghcr.io/edgelesssys/ego-deploy:v1.3.0
FROM ghcr.io/edgelesssys/ego-deploy:v1.5.0

# Copy just the binary for the enclave into this build stage
COPY --from=build-enclave \
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/enclave.debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# build-enclave = copies over the source and builds the enclave using a go compiler cache
# final = using the base system copies over only the enclave executable and creates the final image without source and dependencies.

FROM golang:1.20-alpine3.18 as system
FROM golang:1.22.1-alpine3.19 as system

# install build utils
RUN apk add build-base
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/host.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# build-host = copies over the source code and builds the binaries using a compiler cache
# final = copies over only the executables in an alpine image that doesn't have any additional load.

FROM golang:1.20-alpine3.18 as system
FROM golang:1.22.1-alpine3.19 as system
# set the base libs to build / run
RUN apk add build-base bash
ENV CGO_ENABLED=1
Expand Down
Loading

0 comments on commit a486384

Please sign in to comment.