Skip to content

Commit

Permalink
Move to go 1.23 and fix CI (#147)
Browse files Browse the repository at this point in the history
* Move to go 1.23

* Update golangci-lint

* Fix linting
  • Loading branch information
galt-tr authored Oct 22, 2024
1 parent fa2208f commit c579b12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
needs: [yamllint]
strategy:
matrix:
go-version: [1.22.x]
go-version: [1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ linters-settings:
gocognit:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
gosec:
excludes:
- G115
nestif:
# minimal complexity of if statements to report, 5 by default
min-complexity: 4
Expand Down Expand Up @@ -383,6 +386,7 @@ issues:
- path: _test\.go
linters:
- gocyclo
- testifylint

# Exclude known linters from partially hard-vendored code,
# which is impossible to exclude via "nolint" comments.
Expand Down
2 changes: 1 addition & 1 deletion .make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ lint: ## Run the golangci-lint application (install if not found)
GOPATH=$$(go env GOPATH); \
if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \
echo "Installation path: $$GOPATH/bin"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.59.1; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.61.0; \
fi; \
fi; \
if [ "$(TRAVIS)" != "" ]; then \
Expand Down
19 changes: 1 addition & 18 deletions app/p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,27 +491,10 @@ func generatePrivateKey(filePath string) (*crypto.PrivKey, error) {
return &privateKey, nil
}

// readPrivateKeyFromFile reads a private key from `private_key_path` file
func readPrivateKeyFromFile(filePath string) (*crypto.PrivKey, error) {
// Read private key from a file
privateBytes, err := os.ReadFile(filePath) //nolint:gosec // This is a local private key
if err != nil {
return nil, err
}

// Unmarshal the private key bytes into a key
var privateKey crypto.PrivKey
if privateKey, err = crypto.UnmarshalPrivateKey(privateBytes); err != nil {
return nil, err
}

return &privateKey, nil
}

// readPrivateKey reads a private key from `private_key` hex encoded string
func readPrivateKey(privKeyHex string) (*crypto.PrivKey, error) {
// Read private key from a file
privateBytes, err := hex.DecodeString(privKeyHex) //nolint:gosec // This is a local private key
privateBytes, err := hex.DecodeString(privKeyHex)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c579b12

Please sign in to comment.