-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): use air to reloader and dlv as debugger
The Air utility is a more modern, widely used binary loader and well currently maintained, which makes it a better option than the previous one, the Refresh. Another addition is the use of Delve, a Golang debugger, to facilitate the bugging process for the ShellHub Agent in the host environment. NOTE: This change only affects the development environment. A good extra could append the `substitute-path` configuration to the "~/.config/dlv/config.yml" to substitute the reference to the source code inside the container for the host's one.
- Loading branch information
1 parent
d025397
commit c0b5c30
Showing
5 changed files
with
36 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
root = "." | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
pre_cmd = ["rm ./tmp/dlv.sock"] | ||
cmd = "go build -tags docker -ldflags \"-X main.AgentVersion=latest\" -gcflags=\"all=-N -l\" -o ./tmp/main ." | ||
post_cmd = [] | ||
bin = "" | ||
full_bin = "dlv exec ./tmp/main" | ||
args_bin = [ | ||
"--listen unix:./tmp/dlv.sock", | ||
"--headless", | ||
"--continue", | ||
"--accept-multiclient", | ||
] | ||
delay = 1000 | ||
exclude_dir = ["assets", "tmp", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,8 @@ ARG GOPROXY | |
ENV GOPROXY ${GOPROXY} | ||
|
||
RUN apk add --update openssl openssh-client | ||
RUN go install github.com/markbates/[email protected] && \ | ||
RUN go install github.com/air-verse/[email protected] && \ | ||
go install github.com/go-delve/delve/cmd/[email protected] && \ | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
WORKDIR $GOPATH/src/github.com/shellhub-io/shellhub | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
|
||
refresh run | ||
air |
This file was deleted.
Oops, something went wrong.