Skip to content

Commit

Permalink
add golangci-lint to CI and address outstanding issues (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-block authored Jan 22, 2024
1 parent b7d31fa commit ee9e33e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ jobs:
run: mage build

- name: Test
run: mage citest
run: mage citest

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: impl
10 changes: 0 additions & 10 deletions impl/pkg/server/server_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package server

import (
"bytes"
"io"
"net/http"
"net/http/httptest"
"os"
Expand All @@ -12,7 +10,6 @@ import (

"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/TBD54566975/did-dht-method/config"
)
Expand Down Expand Up @@ -53,13 +50,6 @@ func is2xxResponse(statusCode int) bool {
return statusCode/100 == 2
}

func newJSONRequestValue(t *testing.T, data any) io.Reader {
dataBytes, err := json.Marshal(data)
require.NoError(t, err)
require.NotEmpty(t, dataBytes)
return bytes.NewReader(dataBytes)
}

// construct a context value as expected by our handler
func newRequestContext(w http.ResponseWriter, req *http.Request) *gin.Context {
c, _ := gin.CreateTestContext(w)
Expand Down
17 changes: 11 additions & 6 deletions impl/pkg/service/pkarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,17 @@ func (s *PkarrService) PublishPkarr(ctx context.Context, id string, request Publ

// return here and put it in the DHT asynchronously
// TODO(gabe): consider a background process to monitor failures
go s.dht.Put(ctx, bep44.Put{
V: request.V,
K: &request.K,
Sig: request.Sig,
Seq: request.Seq,
})
go func() {
_, err := s.dht.Put(ctx, bep44.Put{
V: request.V,
K: &request.K,
Sig: request.Sig,
Seq: request.Seq,
})
if err != nil {
logrus.WithError(err).Error("error from dht.Put")
}
}()

return nil
}
Expand Down

0 comments on commit ee9e33e

Please sign in to comment.