Skip to content

Commit

Permalink
Merge pull request #238 from EasyPost/go_123_lint
Browse files Browse the repository at this point in the history
fix: linting on go 1.23
  • Loading branch information
Justintime50 committed Aug 27, 2024
2 parents a4c741f + 1d946d5 commit a9ba547
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
37 changes: 12 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,45 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install dependencies
run: make install
go-version: '1.23'
# install must occur in the same step as the linter to run properly on CI
- name: Lint project
run: make install lint

build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23']
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: use golang ${{ matrix.go-version }}
uses: actions/setup-go@v5
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: install
run: make install
- name: run tests
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install test
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.19' # TODO: There is a bug in 1.20 that isn't calculating coverage correctly
- name: Install dependencies
run: make install
- name: Analyze coverage
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage
- name: Run coverage report
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install coverage
coveralls:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
# NOTE: goveralls is not compatibile with go v1.22+, must remain on v1.21 max
go-version: '1.19' # TODO: There is a bug in 1.20 that isn't calculating coverage correctly
- name: Install dependencies
run: make install
- name: analyze coverage
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage
- name: Run coverage report
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install coverage
- name: Install goveralls
env:
GO111MODULE: off
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ init-examples-submodule:

## install - Install and vendor dependencies
install: | init-examples-submodule
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_BIN) v1.59.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_BIN) v1.60.1
curl -sSfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(GO_BIN)
go mod vendor

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (c *ClientTests) checkExpiredCassette() {
currentTimestamp := time.Now()

if currentTimestamp.After(expirationTimestamp) {
c.T().Logf(fmt.Sprintf("%s is older than %d days and has expired. Please re-record the cassette", fullCassettePath, expirationDays))
c.T().Logf("%s is older than %d days and has expired. Please re-record the cassette", fullCassettePath, expirationDays)
}
}
}
Expand Down

0 comments on commit a9ba547

Please sign in to comment.