diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5096ab5..e297d7d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Go Lint uses: reviewdog/action-golangci-lint@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 94bd0c3..c63a3d8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -27,12 +27,11 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.23.0 + go-version: 1.26 - name: Install dependencies and run tests run: | - go mod download - go test -v -race -covermode=atomic ./... -coverpkg=./... -short -coverprofile=unit_coverage.out + make test - name: Archive code coverage results uses: actions/upload-artifact@v4 diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..5ba2d59 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,39 @@ +version: "2" +linters: + default: all + enable: + - bodyclose + - copyloopvar + - decorder + - errcheck + - errname + - forbidigo + - goconst + - gocritic + - gosec + - govet + - ineffassign + - intrange + - misspell + - nestif + - predeclared + - staticcheck + - testifylint + - unparam + - unused + - wastedassign + - whitespace + - wrapcheck + exclusions: + generated: lax + paths: + - ./examples + +formatters: + settings: + goimports: + local-prefixes: + - github.com/ChargePi/ocpp-manager + enable: + - gofmt + - goimports diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..01ef7bd --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +.PHONY: gen format lint test + +test: + go test -v -race -covermode=atomic ./... -coverpkg=./... -short -coverprofile=unit_coverage.out + +gen: + mockery + +lint: + golangci-lint run + +format: + golangci-lint fmt \ No newline at end of file diff --git a/go.mod b/go.mod index 5389922..76bd20c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/ChargePi/ocpp-manager -go 1.22.1 +go 1.26 replace github.com/lorenzodonini/ocpp-go v0.18.0 => github.com/ChargePi/ocpp-go v0.21.0 diff --git a/ocpp_v16/configuration_test.go b/ocpp_v16/configuration_test.go index 42601a5..00f2625 100644 --- a/ocpp_v16/configuration_test.go +++ b/ocpp_v16/configuration_test.go @@ -95,8 +95,7 @@ func (s *OcppConfigTest) TestSetVersion() { func (s *OcppConfigTest) TestUpdateKey() { // Ok case - newVal := "1234" - err := s.config.UpdateKey("HeartbeatInterval", &newVal) + err := s.config.UpdateKey("HeartbeatInterval", new("1234")) s.Assert().NoError(err) value, err := s.config.GetConfigurationValue("HeartbeatInterval") s.Require().NoError(err)