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

Tlozano/update go version workflows #682

Closed
Closed
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
4 changes: 0 additions & 4 deletions .github/FUNDING.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ updates:
labels:
- update
reviewers:
- ktr0731
- cequals/security
- package-ecosystem: gomod
directory: /
schedule:
interval: monthly
labels:
- update
reviewers:
- ktr0731
- cequals/security
8 changes: 8 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func Get(fs *pflag.FlagSet) (*Config, error) {

func newDefaultViper() *viper.Viper {
v := viper.New()

v.SetDefault("default.protoPath", []string{""})
v.SetDefault("default.protoFile", []string{""})
v.SetDefault("default.package", "")
Expand Down Expand Up @@ -168,6 +169,13 @@ func newDefaultViper() *viper.Viper {
v.SetDefault("request.certKeyFile", "")
v.SetDefault("request.web", false)

v.SetEnvPrefix("EVANS")
v.SetEnvKeyReplacer(strings.NewReplacer(
".", "_", // for nested values
))
v.AllowEmptyEnv(true)
v.AutomaticEnv()

return v
}

Expand Down
26 changes: 16 additions & 10 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ func setupEnv(t *testing.T) (string, string, func()) {
}

mustChdir(t, dir)
oldEnv := os.Getenv("XDG_CONFIG_HOME")
cfgDir := filepath.Join(dir, "config")
os.Setenv("XDG_CONFIG_HOME", cfgDir)
t.Setenv("XDG_CONFIG_HOME", cfgDir)
evansCfgDir := filepath.Join(cfgDir, "evans")
mkdir(t, evansCfgDir)

return dir, evansCfgDir, func() {
mustChdir(t, cwd)
os.Setenv("XDG_CONFIG_HOME", oldEnv)
os.RemoveAll(dir)
viper.Reset()
}
Expand Down Expand Up @@ -172,7 +170,6 @@ func TestLoad(t *testing.T) {
}
}
}

assertWithGolden(t, "create a default global config if both of global and local config are not found",
func(t *testing.T) *Config {
_, _, cleanup := setupEnv(t)
Expand All @@ -185,6 +182,19 @@ func TestLoad(t *testing.T) {
return cfg
})

t.Run("load an environmental variable that overrides local config", func(t *testing.T) {
t.Setenv("EVANS_SERVER_PORT", "9001")

_, _, cleanup := setupEnv(t)
defer cleanup()

cfg := mustGet(t, nil)

if cfg.Server.Port != "9001" {
t.Errorf("port %s not set by os env", cfg.Server.Port)
}
})

assertWithGolden(t, "load a global config if local config is not found", func(t *testing.T) *Config {
oldCWD := getWorkDir(t)

Expand Down Expand Up @@ -329,9 +339,7 @@ func TestEdit(t *testing.T) {
for name, c := range cases {
c := c
t.Run(name, func(t *testing.T) {
oldEnv := os.Getenv("EDITOR")
os.Setenv("EDITOR", c.expectedEditor)
defer os.Setenv("EDITOR", oldEnv)
t.Setenv("EDITOR", c.expectedEditor)

if c.outsideGitRepo {
wd, err := os.Getwd()
Expand Down Expand Up @@ -393,9 +401,7 @@ func TestEditGlobal(t *testing.T) {
for name, c := range cases {
c := c
t.Run(name, func(t *testing.T) {
oldEnv := os.Getenv("EDITOR")
os.Setenv("EDITOR", c.expectedEditor)
defer os.Setenv("EDITOR", oldEnv)
t.Setenv("EDITOR", c.expectedEditor)

var called bool
runEditor = func(editor string, cfgPath string) error {
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func compareWithGolden(t *testing.T, actual string) {
if err != nil {
t.Fatalf("failed to load a golden file: %s", err)
}
expected := goldenReplacer.Replace(string(b))
expected := string(b)

if diff := cmp.Diff(expected, actual); diff != "" {
t.Errorf("wrong result: \n%s", diff)
Expand Down
3 changes: 0 additions & 3 deletions e2e/old_repl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,4 @@ var (
`"`, "",
",", "",
)
goldenReplacer = strings.NewReplacer(
"\r", "", // For Windows.
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
]
},
"trailer": {
"grpc-status-details-bin": [
"\u0008\r\u0012\u000einternal error\u001aC\n)type.googleapis.com/google.rpc.BadRequest\u0012\u0016\n\u0014\n\u0005field\u0012\u000bdescription\u001aT\n2type.googleapis.com/google.rpc.PreconditionFailure\u0012\u001e\n\u001c\n\u0004type\u0012\u0007subject\u001a\u000bdescription"
],
"trailer_key1": [
"trailer_val1"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ content-type: application/grpc
header_key1: header_val1
header_key2: header_val2

grpc-status-details-bin: internal errorC
)type.googleapis.com/google.rpc.BadRequest

field descriptionT
2type.googleapis.com/google.rpc.PreconditionFailure

typesubject description
trailer_key1: trailer_val1
trailer_key2: trailer_val2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ content-type: application/grpc
header_key1: header_val1
header_key2: header_val2

grpc-status-details-bin: internal errorC
)type.googleapis.com/google.rpc.BadRequest

field descriptionT
2type.googleapis.com/google.rpc.PreconditionFailure

typesubject description
trailer_key1: trailer_val1
trailer_key2: trailer_val2

Expand Down
100 changes: 52 additions & 48 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ go 1.20

require (
github.com/Songmu/gocredits v0.3.0
github.com/bufbuild/protocompile v0.1.0
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
github.com/fatih/color v1.13.0
github.com/golang/protobuf v1.5.2
github.com/bufbuild/protocompile v0.6.0
github.com/chzyer/readline v1.5.1
github.com/fatih/color v1.15.0
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.5.9
github.com/goreleaser/goreleaser v1.11.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/jhump/protoreflect v1.14.0
github.com/jhump/protoreflect v1.15.3
github.com/k0kubun/pp v3.0.1+incompatible
github.com/kisielk/godepgraph v0.0.0-20190626013829-57a7e4a651a9
github.com/ktr0731/bump v0.1.0
Expand All @@ -25,33 +25,33 @@ require (
github.com/manifoldco/promptui v0.9.0
github.com/matryer/moq v0.2.7
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.19
github.com/mattn/go-isatty v0.0.20
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
github.com/pelletier/go-toml v1.9.5
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.7
github.com/spf13/cobra v1.6.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.14.0
github.com/spf13/viper v1.17.0
github.com/tj/go-spin v1.1.0
github.com/zchee/go-xdgbasedir v1.0.3
go.uber.org/goleak v1.2.0
golang.org/x/sync v0.1.0
golang.org/x/tools v0.6.0
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.30.0
golang.org/x/sync v0.4.0
golang.org/x/tools v0.14.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
)

require (
cloud.google.com/go v0.104.0 // indirect
cloud.google.com/go/compute v1.12.1 // indirect
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/kms v1.4.0 // indirect
cloud.google.com/go/storage v1.23.0 // indirect
cloud.google.com/go v0.110.8 // indirect
cloud.google.com/go/compute v1.23.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.3 // indirect
cloud.google.com/go/kms v1.15.3 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
code.gitea.io/sdk/gitea v0.15.1 // indirect
github.com/AlekSi/pointer v1.2.0 // indirect
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
Expand Down Expand Up @@ -127,16 +127,16 @@ require (
github.com/google/go-github/v47 v47.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/rpmpack v0.0.0-20220314092521-38642b5e571e // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/google/wire v0.5.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/goreleaser/chglog v0.2.2 // indirect
github.com/goreleaser/fileglob v1.3.0 // indirect
github.com/goreleaser/nfpm/v2 v2.18.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -145,21 +145,21 @@ require (
github.com/imdario/mergo v0.3.13 // indirect
github.com/improbable-eng/grpc-web v0.14.1 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.6.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/kevinburke/ssh_config v1.1.0 // indirect
github.com/klauspost/compress v1.15.1 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/ktr0731/dept v0.1.3 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-pipeline v0.0.0-20170920030317-cfb87a531e2b // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/mattn/go-pipeline v0.0.0-20190323144519-32d779b32768 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-tty v0.0.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
Expand All @@ -169,43 +169,47 @@ require (
github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68 // indirect
github.com/muesli/roff v0.1.0 // indirect
github.com/muesli/termenv v0.12.1-0.20220615005108-4e9068de9898 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/term v1.2.0-beta.2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/slack-go/slack v0.11.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 // indirect
github.com/xanzy/go-gitlab v0.73.1 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
gocloud.dev v0.26.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.102.0 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/mail.v2 v2.3.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
Loading