Skip to content

Commit

Permalink
Merge pull request #158 from EasyPost/go_123_lint
Browse files Browse the repository at this point in the history
fix: go linting on v1.23
  • Loading branch information
Justintime50 committed Aug 26, 2024
2 parents 4bd05ec + 1953b65 commit 40ec163
Show file tree
Hide file tree
Showing 122 changed files with 171 additions and 177 deletions.
35 changes: 12 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
shell:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Run sh-checker
uses: luizm/action-sh-checker@master
env:
Expand All @@ -20,38 +19,33 @@ jobs:
csharp:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install C# dependencies
run: make install-csharp
- name: Lint project
run: make lint-csharp
go:
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
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-go lint-go
run: make install-go lint-go
java:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install Java dependencies
run: make install-java
- name: Lint project
run: make lint-java
node:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install dependencies
run: make install-node
- name: Lint project
Expand All @@ -61,17 +55,15 @@ jobs:
php:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install dependencies
run: make install-php
- name: Lint project
run: make lint-php
python:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Install Python dependencies
run: make install-python
- name: Lint project
Expand All @@ -81,10 +73,8 @@ jobs:
ruby:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
rubygems: '3.0.0'
Expand All @@ -96,7 +86,6 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- name: Check for current dirs in docs
run: ./test/ensure-current-dirs-exist.sh
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ install-csharp:
## install-go - Install and vendor Go dependencies
install-go:
sh ./symlink_directory_files.sh style_guides/golang .
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.3
go mod vendor

## install-java - installs Java dependencies
Expand Down Expand Up @@ -83,7 +83,7 @@ lint-csharp:

## lint-go - Lint Go files
lint-go:
$(GO_BIN)/golangci-lint run
$(GO_BIN)/golangci-lint run official/docs/golang/current/... community/... official/guides/...

## lint-java - lints Java files
lint-java:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (h *Handler) HandlePaymentEvent(event *easypost.Event) {
}
verb := strings.TrimPrefix(event.Description, "payment.")
log.Printf(
"payment %s %s with amount %s and status %d\n",
"payment %s %s with amount %s and status %v\n",
payment.ID, verb, payment.Amount, payment.Status,
)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ go 1.15
require (
github.com/EasyPost/easypost-go/v2 v2.20.0
github.com/EasyPost/easypost-go/v3 v3.2.0
github.com/EasyPost/easypost-go/v4 v4.3.0
github.com/EasyPost/easypost-go/v4 v4.6.0
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/EasyPost/easypost-go/v2 v2.20.0 h1:DSqpwwTq2XDLg3Nlfk9KSoMHNEyZsqJSyM
github.com/EasyPost/easypost-go/v2 v2.20.0/go.mod h1:+C9K2M4jvFSvN06xYXM2qom4zxmxPDTObQHu++C3hCs=
github.com/EasyPost/easypost-go/v3 v3.2.0 h1:dNWmPG1AkpgYFJxhw/zGzCz1JOVXPpNIi8+JND4UHzk=
github.com/EasyPost/easypost-go/v3 v3.2.0/go.mod h1:WDD0qkjwxedVKFXCcdJBz22rtRHpuxjGazgSVcTfdIw=
github.com/EasyPost/easypost-go/v4 v4.3.0 h1:UgYZOJuMK2mbXBHSrWlazGzYyYys14QstSFeFDQ98aM=
github.com/EasyPost/easypost-go/v4 v4.3.0/go.mod h1:WGoS4tmjHquhooMNmY6RirP+KWeYV/akcf/Jg9Q6fsk=
github.com/EasyPost/easypost-go/v4 v4.6.0 h1:wxMK4wkGEG5vW/4Vdy3rwE9iqww1eQ1xS6oYWUZbhrc=
github.com/EasyPost/easypost-go/v4 v4.6.0/go.mod h1:WGoS4tmjHquhooMNmY6RirP+KWeYV/akcf/Jg9Q6fsk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func createAndVerify() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.CreateAndVerifyAddress(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func create() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.CreateAddress(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func list() {
client := easypost.New("EASYPOST_API_KEY")

addresses, _ := client.ListAddresses(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func retrieve() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.GetAddress("adr_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/verify-failure.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func verifyFailure() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.CreateAddress(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/verify-param.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func verifyParam() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.CreateAddress(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func verifyStrictParam() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.CreateAddress(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/addresses/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func verify() {
client := easypost.New("EASYPOST_API_KEY")

address, _ := client.VerifyAddress("adr_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/api-keys/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func retrieve() {
client := easypost.New("EASYPOST_API_KEY")

// Retrieve all API keys including children
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/add-shipments.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func addShipments() {
client := easypost.New("EASYPOST_API_KEY")

shipment, _ := client.GetShipment("shp_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/buy.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func buy() {
client := easypost.New("EASYPOST_API_KEY")

createdBatch, _ := client.CreateBatch(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func create() {
client := easypost.New("EASYPOST_API_KEY")

shipment, _ := client.GetShipment("shp_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func label() {
client := easypost.New("EASYPOST_API_KEY")

batch, _ := client.GetBatchLabels("batch_...", "PDF")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func list() {
client := easypost.New("EASYPOST_API_KEY")

batches, _ := client.ListBatches(
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/remove-shipments.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func removeShipments() {
client := easypost.New("EASYPOST_API_KEY")

shipment, _ := client.GetShipment("shp_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func retrieve() {
client := easypost.New("EASYPOST_API_KEY")

batch, _ := client.GetBatch("batch_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/batches/scan-forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func scanForms() {
client := easypost.New("EASYPOST_API_KEY")

batch, _ := client.CreateBatchScanForms("batch_...", "pdf")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func createEpCreditCard() {
client := easypost.New("EASYPOST_API_KEY")

creditCard, _ := client.AddReferralCustomerCreditCard("REFERRAL_USER_API_KEY", &easypost.CreditCardOptions{
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/billing/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func delete() {
client := easypost.New("EASYPOST_API_KEY")

err := client.DeletePaymentMethod(easypost.PrimaryPaymentMethodPriority)
Expand Down
4 changes: 2 additions & 2 deletions official/docs/golang/current/billing/fund.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func fund() {
client := easypost.New("EASYPOST_API_KEY")

client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)
_ = client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)
}
2 changes: 1 addition & 1 deletion official/docs/golang/current/billing/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func list() {
client := easypost.New("EASYPOST_API_KEY")

paymentMethods, _ := client.RetrievePaymentMethods()
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/brand/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func brand() {
client := easypost.New("EASYPOST_API_KEY")

brand, _ := client.UpdateBrand(
Expand Down
6 changes: 4 additions & 2 deletions official/docs/golang/current/carrier-accounts/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func create() {
client := easypost.New("EASYPOST_API_KEY")

carrierAccount, _ := client.CreateCarrierAccount(
Expand All @@ -28,14 +28,16 @@ func main() {
},
)

fmt.Println(carrierAccount)

// For UPS account creation, please use below method instead

createUpsParameters := &easypost.UpsCarrierAccountCreationParameters{
AccountNumber: "123456789",
Type: "UpsAccount",
}

carrierAccount, err := client.CreateUpsCarrierAccount(createUpsParameters)
carrierAccount, _ = client.CreateUpsCarrierAccount(createUpsParameters)

fmt.Println(carrierAccount)
}
2 changes: 1 addition & 1 deletion official/docs/golang/current/carrier-accounts/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func delete() {
client := easypost.New("EASYPOST_API_KEY")

err := client.DeleteCarrierAccount("ca_...")
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/carrier-accounts/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func list() {
client := easypost.New("EASYPOST_API_KEY")

carrierAccounts, _ := client.ListCarrierAccounts()
Expand Down
2 changes: 1 addition & 1 deletion official/docs/golang/current/carrier-accounts/retrieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/EasyPost/easypost-go/v4"
)

func main() {
func retrieve() {
client := easypost.New("EASYPOST_API_KEY")

carrierAccount, _ := client.GetCarrierAccount("ca_...")
Expand Down
Loading

0 comments on commit 40ec163

Please sign in to comment.