Skip to content

Commit

Permalink
fix(ci): debug log printing
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Aug 7, 2024
1 parent d577ae2 commit a0322b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ jobs:

- name: Get dependencies
run: go mod tidy

- name: Enable Debug Log
run: sed -i '' 's/false/true/g' config/global.go

- name: Build
run: go build -v ./...

- name: Test
run: sudo go test -ldflags "-X github.com/fumiama/WireGold/config.ShowDebugLog=true" $(go list ./...) # ip test needs sudo
run: sudo go test $(go list ./...) # ip test needs sudo

lint:
name: Lint
Expand Down
4 changes: 3 additions & 1 deletion gold/p2p/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ func (conn *Conn) WriteToPeer(b []byte, ep p2p.EndPoint) (n int, err error) {
return 0, errors.New("data size " + strconv.Itoa(len(b)) + " is too large")
}
if (!conn.suberr || len(conn.subs) > 0) && !conn.cplk.TryLock() {
logrus.Infoln("[tcp] try sub write")
if config.ShowDebugLog {
logrus.Debug("[tcp] try sub write to", tcpep)
}
n, err = conn.writeToPeer(b, tcpep, true) // try sub write
if err == nil {
return
Expand Down

0 comments on commit a0322b7

Please sign in to comment.