Skip to content

Commit

Permalink
Merge pull request #49 from Songmu/deps
Browse files Browse the repository at this point in the history
update deps except for go-ieproxy
  • Loading branch information
Songmu authored Nov 20, 2022
2 parents 1b884b9 + 25a8529 commit 1104f8c
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 694 deletions.
3 changes: 2 additions & 1 deletion cmd/ecschedule/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"flag"
"log"
"os"
Expand All @@ -10,7 +11,7 @@ import (

func main() {
log.SetFlags(0)
err := ecschedule.Run(os.Args[1:], os.Stdout, os.Stderr)
err := ecschedule.Run(context.Background(), os.Args[1:], os.Stdout, os.Stderr)
if err != nil && err != flag.ErrHelp {
log.Printf("💢 %s\n", err)
exitCode := 1
Expand Down
2 changes: 1 addition & 1 deletion cmd_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var cmdApply = &runnerImpl{
return err
}
defer f.Close()
c, err = LoadConfig(f, a.AccountID, *conf)
c, err = LoadConfig(ctx, f, a.AccountID, *conf)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var cmdDiff = &runnerImpl{
return err
}
defer f.Close()
c, err = LoadConfig(f, a.AccountID, *conf)
c, err = LoadConfig(ctx, f, a.AccountID, *conf)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var cmdDump = &runnerImpl{
return err
}
defer f.Close()
c, err = LoadConfig(f, a.AccountID, *conf)
c, err = LoadConfig(ctx, f, a.AccountID, *conf)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var cmdRun = &runnerImpl{
return err
}
defer f.Close()
c, err = LoadConfig(f, a.AccountID, *conf)
c, err = LoadConfig(ctx, f, a.AccountID, *conf)
if err != nil {
return err
}
Expand Down
9 changes: 5 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ecschedule

import (
"context"
"io"
"io/ioutil"
"path/filepath"
Expand Down Expand Up @@ -40,17 +41,17 @@ func (c *Config) GetRuleByName(name string) *Rule {
return nil
}

func (c *Config) setupPlugins() error {
func (c *Config) setupPlugins(ctx context.Context) error {
for _, p := range c.Plugins {
if err := p.setup(c); err != nil {
if err := p.setup(ctx, c); err != nil {
return err
}
}
return nil
}

// LoadConfig loads config
func LoadConfig(r io.Reader, accountID string, confPath string) (*Config, error) {
func LoadConfig(ctx context.Context, r io.Reader, accountID string, confPath string) (*Config, error) {
c := Config{}
bs, err := ioutil.ReadAll(r)
if err != nil {
Expand All @@ -64,7 +65,7 @@ func LoadConfig(r io.Reader, accountID string, confPath string) (*Config, error)
return nil, err
}
c.AccountID = accountID
if err := c.setupPlugins(); err != nil {
if err := c.setupPlugins(ctx); err != nil {
return nil, err
}
c.dir = filepath.Dir(confPath)
Expand Down
9 changes: 5 additions & 4 deletions config_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ecschedule

import (
"context"
"os"
"reflect"
"testing"
Expand All @@ -17,7 +18,7 @@ func TestLoadConfig(t *testing.T) {
}
defer f.Close()

c, err := LoadConfig(f, "334", path)
c, err := LoadConfig(context.Background(), f, "334", path)
if err != nil {
t.Errorf("error shoud be nil, but: %s", err)
}
Expand Down Expand Up @@ -92,7 +93,7 @@ func TestLoadConfig_mustEnv(t *testing.T) {
}
defer f.Close()

c, err := LoadConfig(f, "335", path)
c, err := LoadConfig(context.Background(), f, "335", path)
if err != nil {
t.Errorf("error shoud be nil, but: %s", err)
}
Expand All @@ -115,7 +116,7 @@ func TestLoadConfig_tfstate(t *testing.T) {
}
defer f.Close()

c, err := LoadConfig(f, "336", path)
c, err := LoadConfig(context.Background(), f, "336", path)
if err != nil {
t.Errorf("error shoud be nil, but: %s", err)
}
Expand Down Expand Up @@ -147,7 +148,7 @@ func TestLoadConfig_undefined(t *testing.T) {
}
defer f.Close()

c, err := LoadConfig(f, "337", path)
c, err := LoadConfig(context.Background(), f, "337", path)
if err != nil {
t.Errorf("error shoud be nil, but: %s", err)
}
Expand Down
6 changes: 3 additions & 3 deletions ecsched.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const cmdName = "ecschedule"

// Run the ecschedule
func Run(argv []string, outStream, errStream io.Writer) error {
func Run(ctx context.Context, argv []string, outStream, errStream io.Writer) error {
log.SetOutput(errStream)
log.SetPrefix(fmt.Sprintf("[%s] ", cmdName))
nameAndVer := fmt.Sprintf("%s (v%s rev:%s)", cmdName, version, revision)
Expand Down Expand Up @@ -57,13 +57,13 @@ func Run(argv []string, outStream, errStream io.Writer) error {
return err
}
defer f.Close()
c, err := LoadConfig(f, a.AccountID, *conf)
c, err := LoadConfig(ctx, f, a.AccountID, *conf)
if err != nil {
return err
}
a.Config = c
}
ctx := setApp(context.Background(), a)
ctx = setApp(ctx, a)
argv = fs.Args()
if len(argv) < 1 {
return fmt.Errorf("no subcommand specified")
Expand Down
88 changes: 54 additions & 34 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,88 @@ module github.com/Songmu/ecschedule
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.52
github.com/fujiwara/tfstate-lookup v0.4.4
github.com/goccy/go-yaml v1.9.5
github.com/aws/aws-sdk-go v1.44.142
github.com/fujiwara/tfstate-lookup v1.0.0
github.com/goccy/go-yaml v1.9.6
github.com/kayac/go-config v0.6.0
github.com/pkg/errors v0.9.1
github.com/sergi/go-diff v1.2.0
)

require (
cloud.google.com/go v0.103.0 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/storage v1.23.0 // indirect
cloud.google.com/go v0.107.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.7.0 // indirect
cloud.google.com/go/storage v1.28.0 // indirect
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go v67.1.0+incompatible // indirect
github.com/Azure/azure-storage-blob-go v0.15.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.2 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.41 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.16 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.20 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.19 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.25 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.17.4 // indirect
github.com/aws/smithy-go v1.13.4 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-slug v0.9.1 // indirect
github.com/hashicorp/go-tfe v1.4.0 // indirect
github.com/hashicorp/go-slug v0.10.0 // indirect
github.com/hashicorp/go-tfe v1.13.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/jsonapi v0.0.0-20210826224640-ee7dae0fb22d // indirect
github.com/itchyny/gojq v0.12.8 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect
github.com/itchyny/gojq v0.12.9 // indirect
github.com/itchyny/timefmt-go v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/oauth2 v0.0.0-20220630143837-2104d58473e0 // indirect
golang.org/x/sys v0.0.0-20220712014510-0a85c31ab51e // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/api v0.86.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.2.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.103.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220711200234-e2551ce405a2 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 1104f8c

Please sign in to comment.