diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2eb10672..f748c07b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,4 +59,10 @@ jobs: run: mage build - name: Test - run: mage citest \ No newline at end of file + run: mage citest + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + working-directory: impl \ No newline at end of file diff --git a/impl/pkg/server/server_test.go b/impl/pkg/server/server_test.go index a4c6d562..0a7c6ce4 100644 --- a/impl/pkg/server/server_test.go +++ b/impl/pkg/server/server_test.go @@ -1,8 +1,6 @@ package server import ( - "bytes" - "io" "net/http" "net/http/httptest" "os" @@ -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" ) @@ -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) diff --git a/impl/pkg/service/pkarr.go b/impl/pkg/service/pkarr.go index 8eeb69f2..f9e4efed 100644 --- a/impl/pkg/service/pkarr.go +++ b/impl/pkg/service/pkarr.go @@ -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 }