Repository: sa7mon/S3Scanner (language: python)

Issue:
Test and document `go install` installation method
```
go install github.com/sa7mon/S3Scanner@latest                                                                                  
go: downloading github.com/sa7mon/S3Scanner v0.0.0-20230729025451-1610ed44ee21
go: github.com/sa7mon/S3Scanner@latest: github.com/sa7mon/S3Scanner@v0.0.0-20230729025451-1610ed44ee21: parsing go.mod:
	module declares its path as: s3scanner
	        but was required as: github.com/sa7mon/S3Scanner
```

Looks like we need to change the module name to include the project url


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml
index 823fa67..e2f01e5 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -36,7 +36,7 @@ jobs:
           #
           # Note: By default, the `.golangci.yml` file should be at the root of the repository.
           # The location of the configuration file can be changed by using `--config=`
-          # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
+          args: --timeout=5m
 
           # Optional: show only new issues if it's a pull request. The default value is `false`.
           # only-new-issues: true
diff --git a/bucket/bucket.go b/bucket/bucket.go
index fdfa264..001b77a 100644
--- a/bucket/bucket.go
+++ b/bucket/bucket.go
@@ -5,10 +5,10 @@ import (
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
 	"github.com/aws/aws-sdk-go-v2/service/s3/types"
+	"github.com/sa7mon/s3scanner/groups"
 	log "github.com/sirupsen/logrus"
 	"os"
 	"regexp"
-	"s3scanner/groups"
 	"strings"
 	"time"
 	"unicode"
diff --git a/cmd/mqingest/mqingest.go b/cmd/mqingest/mqingest.go
index f2e76d0..706b1ae 100644
--- a/cmd/mqingest/mqingest.go
+++ b/cmd/mqingest/mqingest.go
@@ -5,10 +5,10 @@ import (
 	"encoding/json"
 	"flag"
 	"fmt"
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/streadway/amqp"
 	"log"
 	"os"
-	"s3scanner/bucket"
 	"strings"
 )
 
diff --git a/db/database.go b/db/database.go
index add3316..b94e310 100644
--- a/db/database.go
+++ b/db/database.go
@@ -1,12 +1,12 @@
 package db
 
 import (
+	"github.com/sa7mon/s3scanner/bucket"
 	"gorm.io/driver/postgres"
 	"gorm.io/gorm"
 	"gorm.io/gorm/logger"
 	"log"
 	"os"
-	"s3scanner/bucket"
 	"time"
 )
 
diff --git a/go.mod b/go.mod
index 6613e32..cd30eb1 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module s3scanner
+module github.com/sa7mon/s3scanner
 
 go 1.18
 
diff --git a/main.go b/main.go
index 47e47b5..2139a3b 100644
--- a/main.go
+++ b/main.go
@@ -7,16 +7,16 @@ import (
 	"flag"
 	"fmt"
 	"github.com/dustin/go-humanize"
+	"github.com/sa7mon/s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/db"
+	log2 "github.com/sa7mon/s3scanner/log"
+	"github.com/sa7mon/s3scanner/mq"
+	"github.com/sa7mon/s3scanner/provider"
 	log "github.com/sirupsen/logrus"
 	"github.com/spf13/viper"
 	"github.com/streadway/amqp"
 	"os"
 	"reflect"
-	"s3scanner/bucket"
-	"s3scanner/db"
-	log2 "s3scanner/log"
-	"s3scanner/mq"
-	. "s3scanner/provider"
 	"strings"
 	"sync"
 	"text/tabwriter"
@@ -46,7 +46,7 @@ func printResult(b *bucket.Bucket) {
 	log.Info(result)
 }
 
-func work(wg *sync.WaitGroup, buckets chan bucket.Bucket, provider StorageProvider, enumerate bool, writeToDB bool) {
+func work(wg *sync.WaitGroup, buckets chan bucket.Bucket, provider provider.StorageProvider, enumerate bool, writeToDB bool) {
 	defer wg.Done()
 	for b1 := range buckets {
 		b, existsErr := provider.BucketExists(&b1)
@@ -86,7 +86,7 @@ func work(wg *sync.WaitGroup, buckets chan bucket.Bucket, provider StorageProvid
 	}
 }
 
-func mqwork(threadId int, wg *sync.WaitGroup, conn *amqp.Connection, provider StorageProvider, queue string, threads int,
+func mqwork(threadId int, wg *sync.WaitGroup, conn *amqp.Connection, provider provider.StorageProvider, queue string, threads int,
 	doEnumerate bool, writeToDB bool) {
 	_, once := os.LookupEnv("TEST_MQ") // If we're being tested, exit after one bucket is scanned
 	defer wg.Done()
@@ -288,7 +288,7 @@ func main() {
 	flagSettings := make(map[string]flagSetting, 11)
 	flag.StringVar(&args.providerFlag, "provider", "aws", fmt.Sprintf(
 		"Object storage provider: %s - custom requires config file.",
-		strings.Join(AllProviders, ", ")))
+		strings.Join(provider.AllProviders, ", ")))
 	flagSettings["provider"] = flagSetting{category: CategoryOptions}
 	flag.StringVar(&args.bucketName, "bucket", "", "Name of bucket to check.")
 	flagSettings["bucket"] = flagSetting{category: CategoryInput}
@@ -387,7 +387,7 @@ func main() {
 		log.SetFormatter(&log.TextFormatter{DisableTimestamp: true})
 	}
 
-	var provider StorageProvider
+	var p provider.StorageProvider
 	var err error
 	configErr := validateConfig(args)
 	if configErr != nil {
@@ -397,7 +397,7 @@ func main() {
 	if args.providerFlag == "custom" {
 		if viper.IsSet("providers.custom") {
 			log.Debug("found custom provider")
-			provider, err = NewCustomProvider(
+			p, err = provider.NewCustomProvider(
 				viper.GetString("providers.custom.address_style"),
 				viper.GetBool("providers.custom.insecure"),
 				viper.GetStringSlice("providers.custom.regions"),
@@ -408,7 +408,7 @@ func main() {
 			}
 		}
 	} else {
-		provider, err = NewProvider(args.providerFlag)
+		p, err = provider.NewProvider(args.providerFlag)
 		if err != nil {
 			log.Error(err)
 			os.Exit(1)
@@ -433,7 +433,7 @@ func main() {
 
 		for i := 0; i < args.threads; i++ {
 			wg.Add(1)
-			go work(&wg, buckets, provider, args.doEnumerate, args.writeToDB)
+			go work(&wg, buckets, p, args.doEnumerate, args.writeToDB)
 		}
 
 		if args.bucketFile != "" {
@@ -466,7 +466,7 @@ func main() {
 
 	for i := 0; i < args.threads; i++ {
 		wg.Add(1)
-		go mqwork(i, &wg, conn, provider, mqName, args.threads, args.doEnumerate, args.writeToDB)
+		go mqwork(i, &wg, conn, p, mqName, args.threads, args.doEnumerate, args.writeToDB)
 	}
 	log.Printf("Waiting for messages. To exit press CTRL+C")
 	wg.Wait()
diff --git a/permission/permission.go b/permission/permission.go
index 804c6be..4af319b 100644
--- a/permission/permission.go
+++ b/permission/permission.go
@@ -7,9 +7,9 @@ import (
 	"github.com/aws/aws-sdk-go-v2/aws"
 	awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
+	. "github.com/sa7mon/s3scanner/bucket"
+	. "github.com/sa7mon/s3scanner/groups"
 	log "github.com/sirupsen/logrus"
-	. "s3scanner/bucket"
-	. "s3scanner/groups"
 	"strings"
 	"time"
 )
diff --git a/provider/aws.go b/provider/aws.go
index 28c7f31..dcd153f 100644
--- a/provider/aws.go
+++ b/provider/aws.go
@@ -8,8 +8,8 @@ import (
 	"github.com/aws/aws-sdk-go-v2/config"
 	"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
+	"github.com/sa7mon/s3scanner/bucket"
 	log "github.com/sirupsen/logrus"
-	"s3scanner/bucket"
 )
 
 type providerAWS struct {
diff --git a/provider/custom.go b/provider/custom.go
index 2ada1fb..723621f 100644
--- a/provider/custom.go
+++ b/provider/custom.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/bucket"
 	"strings"
 )
 
diff --git a/provider/digitalocean.go b/provider/digitalocean.go
index b4ddff1..93d06d8 100644
--- a/provider/digitalocean.go
+++ b/provider/digitalocean.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/bucket"
 )
 
 type providerDO struct {
diff --git a/provider/dreamhost.go b/provider/dreamhost.go
index 49d56df..9bb2b95 100644
--- a/provider/dreamhost.go
+++ b/provider/dreamhost.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/bucket"
 )
 
 type ProviderDreamhost struct {
diff --git a/provider/gcp.go b/provider/gcp.go
index e8d9c95..ebcd08f 100644
--- a/provider/gcp.go
+++ b/provider/gcp.go
@@ -3,7 +3,7 @@ package provider
 import (
 	"errors"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/bucket"
 )
 
 // GCP like AWS, has a "universal" endpoint, but unlike AWS GCP does not require you to follow a redirect to the
diff --git a/provider/linode.go b/provider/linode.go
index fb4dcbf..d81b46f 100644
--- a/provider/linode.go
+++ b/provider/linode.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
-	"s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/bucket"
 )
 
 type providerLinode struct {
diff --git a/provider/providers.go b/provider/providers.go
index 48aaa1e..01f385d 100644
--- a/provider/providers.go
+++ b/provider/providers.go
@@ -11,10 +11,10 @@ import (
 	"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
 	"github.com/aws/aws-sdk-go-v2/service/s3/types"
+	"github.com/sa7mon/s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/permission"
 	log "github.com/sirupsen/logrus"
 	"net/http"
-	"s3scanner/bucket"
-	"s3scanner/permission"
 	"time"
 )
 


Test patch:
diff --git a/bucket/bucket_test.go b/bucket/bucket_test.go
index 35d9363..f8e6386 100644
--- a/bucket/bucket_test.go
+++ b/bucket/bucket_test.go
@@ -5,11 +5,11 @@ import (
 	"fmt"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
 	"github.com/aws/aws-sdk-go-v2/service/s3/types"
+	"github.com/sa7mon/s3scanner/groups"
 	"github.com/stretchr/testify/assert"
 	"golang.org/x/sync/errgroup"
 	"path/filepath"
 	"runtime"
-	"s3scanner/groups"
 	"testing"
 	"time"
 )
diff --git a/db/database_test.go b/db/database_test.go
index e9ac25c..f115b2e 100644
--- a/db/database_test.go
+++ b/db/database_test.go
@@ -2,10 +2,10 @@ package db
 
 import (
 	"fmt"
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
 	"math/rand"
 	"os"
-	"s3scanner/bucket"
 	"testing"
 	"time"
 )
diff --git a/main_test.go b/main_test.go
index a33e2bc..3a83f42 100644
--- a/main_test.go
+++ b/main_test.go
@@ -3,14 +3,14 @@ package main
 import (
 	"bytes"
 	"encoding/json"
+	"github.com/sa7mon/s3scanner/bucket"
+	"github.com/sa7mon/s3scanner/mq"
+	"github.com/sa7mon/s3scanner/provider"
 	log "github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus/hooks/writer"
 	"github.com/streadway/amqp"
 	"github.com/stretchr/testify/assert"
 	"os"
-	"s3scanner/bucket"
-	"s3scanner/mq"
-	"s3scanner/provider"
 	"sync"
 	"testing"
 )
diff --git a/permission/permission_test.go b/permission/permission_test.go
index e73a8e1..7fe1cba 100644
--- a/permission/permission_test.go
+++ b/permission/permission_test.go
@@ -5,9 +5,9 @@ import (
 	"github.com/aws/aws-sdk-go-v2/aws"
 	"github.com/aws/aws-sdk-go-v2/config"
 	"github.com/aws/aws-sdk-go-v2/service/s3"
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
 	"os"
-	"s3scanner/bucket"
 	"testing"
 )
 
diff --git a/provider/aws_test.go b/provider/aws_test.go
index 3baf969..98e725e 100644
--- a/provider/aws_test.go
+++ b/provider/aws_test.go
@@ -1,8 +1,8 @@
 package provider
 
 import (
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
-	"s3scanner/bucket"
 	"testing"
 )
 
diff --git a/provider/custom_test.go b/provider/custom_test.go
index 72aeb4e..47929c3 100644
--- a/provider/custom_test.go
+++ b/provider/custom_test.go
@@ -1,8 +1,8 @@
 package provider
 
 import (
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
-	"s3scanner/bucket"
 	"testing"
 )
 
diff --git a/provider/digitalocean_test.go b/provider/digitalocean_test.go
index ec00dc3..668068b 100644
--- a/provider/digitalocean_test.go
+++ b/provider/digitalocean_test.go
@@ -1,8 +1,8 @@
 package provider
 
 import (
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
-	"s3scanner/bucket"
 	"testing"
 )
 
diff --git a/provider/providers_test.go b/provider/providers_test.go
index 09ed374..ca6eb98 100644
--- a/provider/providers_test.go
+++ b/provider/providers_test.go
@@ -1,9 +1,9 @@
 package provider
 
 import (
+	"github.com/sa7mon/s3scanner/bucket"
 	"github.com/stretchr/testify/assert"
 	"os"
-	"s3scanner/bucket"
 	"testing"
 )