Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: linting on go 1.23 #238

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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