Skip to content

Commit

Permalink
Start using Go Modules
Browse files Browse the repository at this point in the history
Similar to the original implementation for Go Modules in #712, here we
add a `go.mod` and `go.sum`, then proceed to use Go Modules style
import paths everywhere that include the current major revision.

Unfortunately, this may still cause trouble for Dep users who are trying
to upgrade stripe-go, but the project's now had two years to help its
users with basic Go Module awareness, and has chosen not to do so. It's
received no commits of any kind since August 2019, and therefore would
be considered unmaintained by most definitions. Elsewhere, Go Modules
now seem to be the only and obvious way forward, so we're likely to see
more and more users on them.

`scripts/check_api_clients/main.go` is also updated to be smarter about
breaking down package paths which may now include the major.

[1] golang/dep#1963
  • Loading branch information
brandur authored and remi-stripe committed Apr 16, 2020
1 parent f7882bf commit 25249a9
Show file tree
Hide file tree
Showing 186 changed files with 444 additions and 446 deletions.
54 changes: 12 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,8 @@ Then, import it using:

``` go
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/customer"
)
```

### Go Module Support

The library currently *does not* ship with first-class support for Go
modules. We put in support for it before, but ran into compatibility problems
for existing installations using Dep (see discussion in [closer to the bottom
of this thread][gomodvsdep]), and [reverted support][gomodrevert]. Our current
plan is to wait for better module compatibility in Dep (see a [preliminary
patch here][depgomodsupport]), give the release a little grace time to become
more widely distributed, then bring support back.

For now, require stripe-go in `go.mod` with a version but without a *version
suffix* in the path like so:

``` go
module github.com/my/package

require (
github.com/stripe/stripe-go v70.10.0
)
```

And use the same style of import paths as above:

``` go
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/customer"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/customer"
)
```

Expand Down Expand Up @@ -139,8 +109,8 @@ To use a key, pass it to `API`'s `Init` function:
```go

import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/client"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/client"
)

stripe := &client.API{}
Expand All @@ -161,8 +131,8 @@ import (
"google.golang.org/appengine"
"google.golang.org/appengine/urlfetch"

"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/client"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/client"
)

func handler(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -196,8 +166,8 @@ client.

```go
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/$resource$"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/$resource$"
)

// Setup
Expand Down Expand Up @@ -236,8 +206,8 @@ individual key.

```go
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/client"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/client"
)

// Setup
Expand Down Expand Up @@ -274,8 +244,8 @@ problem by configuring the maximum number of retries:

```go
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/client"
"github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/client"
)

config := &stripe.BackendConfig{
Expand Down
2 changes: 1 addition & 1 deletion account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package stripe
import (
"encoding/json"

"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

// AccountType is the type of an account.
Expand Down
4 changes: 2 additions & 2 deletions account/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package account
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke APIs related to accounts.
Expand Down
4 changes: 2 additions & 2 deletions account/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestAccountDel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

func TestAccountExternalAccountParams_AppendTo(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion accountlink/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package accountlink
import (
"net/http"

stripe "github.com/stripe/stripe-go"
stripe "github.com/stripe/stripe-go/v71"
)

// Client is used to invoke APIs related to account links.
Expand Down
4 changes: 2 additions & 2 deletions accountlink/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestAccountLinkNew(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions applepaydomain/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package applepaydomain
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /apple_pay/domains and Apple Pay domain-related APIs.
Expand Down
4 changes: 2 additions & 2 deletions applepaydomain/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestApplePayDomainDel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion balance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package balance
import (
"net/http"

stripe "github.com/stripe/stripe-go"
stripe "github.com/stripe/stripe-go/v71"
)

// Client is used to invoke /balance and transaction-related APIs.
Expand Down
2 changes: 1 addition & 1 deletion balance/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
_ "github.com/stripe/stripe-go/testing"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestBalanceGet(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions balancetransaction/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package balancetransaction
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /balance_transactions APIs.
Expand Down
4 changes: 2 additions & 2 deletions balancetransaction/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestBalanceTransactionGet(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion bankaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"strconv"

"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

// BankAccountStatus is the list of allowed values for the bank account's status.
Expand Down
4 changes: 2 additions & 2 deletions bankaccount/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /bank_accounts APIs.
Expand Down
4 changes: 2 additions & 2 deletions bankaccount/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestBankAccountDel_ByAccount(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion bankaccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

func TestBankAccount_UnmarshalJSON(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions bitcoinreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ package bitcoinreceiver
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /bitcoin/receivers APIs.
Expand Down
4 changes: 2 additions & 2 deletions bitcoinreceiver/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestBitcoinReceiverGet(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions bitcointransaction/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package bitcointransaction
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /bitcoin/receivers/:receiver_id/transactions APIs.
Expand Down
4 changes: 2 additions & 2 deletions bitcointransaction/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestBitcoinTransactionList(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions capability/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /accounts/capabilities APIs.
Expand Down
4 changes: 2 additions & 2 deletions capability/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestCapabilityGet(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion card.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"strconv"

"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

// CardAvailablePayoutMethod is a set of available payout methods for the card.
Expand Down
4 changes: 2 additions & 2 deletions card/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke /cards APIs.
Expand Down
4 changes: 2 additions & 2 deletions card/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestCardDel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion card_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

func TestCardListParams_AppendTo(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions charge/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package charge
import (
"net/http"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
stripe "github.com/stripe/stripe-go/v71"
"github.com/stripe/stripe-go/v71/form"
)

// Client is used to invoke APIs related to charges.
Expand Down
4 changes: 2 additions & 2 deletions charge/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go"
_ "github.com/stripe/stripe-go/testing"
stripe "github.com/stripe/stripe-go/v71"
_ "github.com/stripe/stripe-go/v71/testing"
)

func TestChargeCapture(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion charge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/form"
"github.com/stripe/stripe-go/v71/form"
)

func TestCharge_UnmarshalJSON(t *testing.T) {
Expand Down
Loading

0 comments on commit 25249a9

Please sign in to comment.