This commit is contained in:
Christian Mehlmauer
2024-08-01 08:09:36 +00:00
parent ee6769f3c1
commit 171309986e
11 changed files with 39 additions and 34 deletions
+7 -10
View File
@@ -3,26 +3,23 @@
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/guiyomh/features/golangci-lint:0": {},
"ghcr.io/devcontainers-contrib/features/go-task:1": {}
"ghcr.io/devcontainers-contrib/features/go-task:1": {},
},
"postCreateCommand": {
"install dependencies": "task setup",
"install required modules": "go mod download"
},
"postCreateCommand": "go mod download",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"shardulm94.trailing-spaces",
"IBM.output-colorizer",
"task.vscode-task",
"github.vscode-github-actions",
"task.vscode-task",
"redhat.vscode-yaml",
"usernamehw.errorlens"
]
+16 -2
View File
@@ -4,16 +4,29 @@ vars:
PROGRAM: gobuster
tasks:
deps:
cmds:
- go mod tidy -v
update:
cmds:
- go get -u
- go mod tidy -v
build:
aliases: [default]
check:
cmds:
- go fmt ./...
- gofumpt -l -w .
- go vet ./...
setup:
cmds:
- go install mvdan.cc/gofumpt@latest
build:
aliases: [default]
deps: [deps, check]
cmds:
- go build -o {{.OUTPUT_FILE | default .PROGRAM}}
env:
CGO_ENABLED: 0
@@ -36,6 +49,7 @@ tasks:
GOARCH: amd64
test:
deps: [deps, check]
env:
CGO_ENABLED: 1 # required by -race
cmds:
+1
View File
@@ -23,6 +23,7 @@ func httpServer(b *testing.B, content string) *httptest.Server {
}))
return ts
}
func BenchmarkDirMode(b *testing.B) {
h := httpServer(b, "test")
defer h.Close()
+4 -2
View File
@@ -11,8 +11,10 @@ import (
"github.com/OJ/gobuster/v3/libgobuster"
)
const ruler = "==============================================================="
const cliProgressUpdate = 500 * time.Millisecond
const (
ruler = "==============================================================="
cliProgressUpdate = 500 * time.Millisecond
)
// resultWorker outputs the results as they come in. This needs to be a range and should not handle
// the context so the channel always has a receiver and libgobuster will not block.
+1 -3
View File
@@ -9,9 +9,7 @@ import (
"github.com/fatih/color"
)
var (
green = color.New(color.FgGreen).FprintfFunc()
)
var green = color.New(color.FgGreen).FprintfFunc()
// Result represents a single result
type Result struct {
-1
View File
@@ -160,7 +160,6 @@ func (s *GobusterGCS) ProcessWord(ctx context.Context, word string, progress *li
// get status
var result map[string]interface{}
err := json.Unmarshal(body, &result)
if err != nil {
return fmt.Errorf("could not parse response json: %w", err)
}
+1 -3
View File
@@ -6,9 +6,7 @@ import (
"github.com/fatih/color"
)
var (
green = color.New(color.FgGreen).FprintfFunc()
)
var green = color.New(color.FgGreen).FprintfFunc()
// Result represents a single result
type Result struct {
+1 -3
View File
@@ -6,9 +6,7 @@ import (
"github.com/fatih/color"
)
var (
green = color.New(color.FgGreen).FprintfFunc()
)
var green = color.New(color.FgGreen).FprintfFunc()
// Result represents a single result
type Result struct {
+1 -3
View File
@@ -7,9 +7,7 @@ import (
"github.com/fatih/color"
)
var (
green = color.New(color.FgGreen).FprintfFunc()
)
var green = color.New(color.FgGreen).FprintfFunc()
// Result represents a single result
type Result struct {
+6 -6
View File
@@ -159,7 +159,7 @@ func TestSetStringify(t *testing.T) {
func TestLineCounter(t *testing.T) {
t.Parallel()
var tt = []struct {
tt := []struct {
testName string
s string
expected int
@@ -190,7 +190,7 @@ func TestLineCounter(t *testing.T) {
func TestLineCounterSlow(t *testing.T) {
t.Parallel()
var tt = []struct {
tt := []struct {
testName string
s string
expected int
@@ -272,7 +272,7 @@ func TestLineCounterError(t *testing.T) {
func TestParseExtensions(t *testing.T) {
t.Parallel()
var tt = []struct {
tt := []struct {
testName string
extensions string
expectedExtensions Set[string]
@@ -303,7 +303,7 @@ func TestParseExtensions(t *testing.T) {
func TestParseCommaSeparatedInt(t *testing.T) {
t.Parallel()
var tt = []struct {
tt := []struct {
stringCodes string
expectedCodes []int
expectedError string
@@ -351,7 +351,7 @@ func TestParseCommaSeparatedInt(t *testing.T) {
}
func BenchmarkParseExtensions(b *testing.B) {
var tt = []struct {
tt := []struct {
testName string
extensions string
expectedExtensions Set[string]
@@ -375,7 +375,7 @@ func BenchmarkParseExtensions(b *testing.B) {
}
func BenchmarkParseCommaSeparatedInt(b *testing.B) {
var tt = []struct {
tt := []struct {
testName string
stringCodes string
expectedCodes Set[int]
+1 -1
View File
@@ -32,7 +32,7 @@ func httpServerT(t *testing.T, content string) *httptest.Server {
}
func randomString(length int) (string, error) {
var letter = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
letter := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
letterLen := len(letter)
b := make([]byte, length)