Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "2"

linters:
enable:
- gocyclo
- gocognit

settings:
gocyclo:
min-complexity: 20

gocognit:
min-complexity: 30
2 changes: 1 addition & 1 deletion cmd/bingo-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"golang.org/x/term"
)

func main() {
func main() { //nolint:gocognit,gocyclo // this is a temporary default client that we will refactor completely later on
cfg, err := config.Load("config/config.yml")
if err != nil {
log.Printf("Failed to load config: %v", err)
Expand Down
8 changes: 8 additions & 0 deletions internal/debuginfo/debug_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ import (
"debug/gosym"
)

// Target represents information about the debugging target process
type Target struct {
Path string
PID int
PGID int
}

type DebugInfo interface {
// GetTarget returns the Target struct of the debugger instance
GetTarget() Target

// PCToLine returns the filename, line number and function from the stack memory address
PCToLine(pc uint64) (file string, line int, fn *gosym.Func)

// LineToPC returns the memory address, function or an error from the filename and line number
LineToPC(file string, line int) (pc uint64, fn *gosym.Func, err error)

// LookupFunc returns the Func struct whose name corresponds to the value of fn
LookupFunc(fn string) *gosym.Func
}
28 changes: 7 additions & 21 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,29 @@
# Documentation: https://lefthook.dev/configuration/

pre-commit:
parallel: true
parallel: false
commands:
format:
imports:
glob: "*.go"
run: gofmt -w {staged_files} && git add {staged_files}
run: goimports -w {staged_files} && git add {staged_files}

vet:
glob: "*.go"
run: go vet ./...

imports:
glob: "*.go"
run: |
if command -v goimports &> /dev/null; then
goimports -w {staged_files} && git add {staged_files}
fi

lint:
glob: "*.go"
run: |
if command -v golangci-lint &> /dev/null; then
golangci-lint run --new-from-rev=HEAD ./...
fi
run: golangci-lint run --new-from-rev=HEAD ./...

pre-push:
commands:
vet:
run: go vet ./cmd/bingo
run: go vet ./...

build:
run: just build
run: go build -o ./build/bingo/bingo ./cmd/bingo

commit-msg:
commands:
check-message:
run: |
if [ ! -f ./build/githook/commitlint ]; then
go build -o ./build/githook/commitlint ./cmd/githook
fi
./build/githook/commitlint {1}
run: go run ./cmd/githook {1}
Loading