Skip to content

Commit

Permalink
Set CGO_ENABLED=1 for arm64 build (#1075)
Browse files Browse the repository at this point in the history
* set CGO_ENABLED=1 for arm64 build

* remove divergent code paths for architectures

* run make clean
  • Loading branch information
charliecruzan-stripe authored May 17, 2023
1 parent d105f2e commit e69b087
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 184 deletions.
2 changes: 2 additions & 0 deletions .goreleaser/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ builds:
ldflags:
- -s -w -X github.com/stripe/stripe-cli/pkg/version.Version={{.Version}}
binary: stripe
env:
- CGO_ENABLED=1
main: ./cmd/stripe/main.go
goos:
- darwin
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ require (
)

require (
github.com/alessio/shellescape v1.4.1
github.com/hashicorp/go-hclog v1.2.2
github.com/hashicorp/go-plugin v1.4.4
github.com/joho/godotenv v1.4.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VM
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
Expand Down
15 changes: 15 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@ func (c *Config) RemoveAllProfiles() error {
return syncConfig(runtimeViper)
}

func deleteLivemodeKey(key string, profile string) error {
fieldID := profile + "." + key
existingKeys, err := KeyRing.Keys()
if err != nil {
return err
}
for _, item := range existingKeys {
if item == fieldID {
KeyRing.Remove(fieldID)
return nil
}
}
return nil
}

// isProfile identifies whether a value in the config pertains to a profile.
func isProfile(value interface{}) bool {
// TODO: ianjabour - ideally find a better way to identify projects in config
Expand Down
19 changes: 0 additions & 19 deletions pkg/config/config_livemode.go

This file was deleted.

19 changes: 0 additions & 19 deletions pkg/config/config_livemode_arm64.go

This file was deleted.

45 changes: 45 additions & 0 deletions pkg/config/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,51 @@ func getKeyExpiresAt() string {
return time.Now().AddDate(0, 0, KeyValidInDays).UTC().Format(DateStringFormat)
}

// saveLivemodeValue saves livemode value of given key in keyring
func (p *Profile) saveLivemodeValue(field, value, description string) {
fieldID := p.GetConfigField(field)
_ = KeyRing.Set(keyring.Item{
Key: fieldID,
Data: []byte(value),
Description: description,
Label: fieldID,
})
}

// retrieveLivemodeValue retrieves livemode value of given key in keyring
func (p *Profile) retrieveLivemodeValue(key string) (string, error) {
fieldID := p.GetConfigField(key)
existingKeys, err := KeyRing.Keys()
if err != nil {
return "", err
}

for _, item := range existingKeys {
if item == fieldID {
value, _ := KeyRing.Get(fieldID)
return string(value.Data), nil
}
}

return "", validators.ErrAPIKeyNotConfigured
}

// deleteLivemodeValue deletes livemode value of given key in keyring
func (p *Profile) deleteLivemodeValue(key string) error {
fieldID := p.GetConfigField(key)
existingKeys, err := KeyRing.Keys()
if err != nil {
return err
}
for _, item := range existingKeys {
if item == fieldID {
KeyRing.Remove(fieldID)
return nil
}
}
return nil
}

// ExperimentalFields are currently only used for request signing
type ExperimentalFields struct {
ContextualName string
Expand Down
55 changes: 0 additions & 55 deletions pkg/config/profile_livemode.go

This file was deleted.

88 changes: 0 additions & 88 deletions pkg/config/profile_livemode_arm64.go

This file was deleted.

0 comments on commit e69b087

Please sign in to comment.