Skip to content

Commit

Permalink
Validate that the bucket name is provided (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
kreamkorokke authored Nov 18, 2020
1 parent a4559f8 commit e814a88
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cmd/network-crawler/network-crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func run() error {
flag.Var(&flagSkippedProviders, "skipped-providers", skippedProvidersUsage)
flag.Parse()

if flagBucketName == nil || *flagBucketName == "" {
return common.NoBucketNameSpecified()
}

if *flagDryRun {
log.Print("Dry run specified. Instead of uploading the content to bucket will just print to stdout.")
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/golangci/golangci-lint v1.32.2 // indirect
github.com/google/martian/v3 v3.1.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.1
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
Expand Down
5 changes: 5 additions & 0 deletions pkg/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ func ErroneousPrefixOrderingError(bucketName string, prefixes []string) error {
len(prefixes),
prefixes)
}

// NoBucketNameSpecified is returned when the script is invoked without a bucket name
func NoBucketNameSpecified() error {
return errors.New("bucket name not specified")
}

0 comments on commit e814a88

Please sign in to comment.