From 3ffbd2e1279458c03563d8aa393cadba55a460e0 Mon Sep 17 00:00:00 2001 From: Joshua Timmons Date: Tue, 26 Dec 2023 22:20:36 -0500 Subject: [PATCH] Fix ci pipeline --- .github/workflows/ci.yaml | 2 +- spanlint.go | 3 +-- testdata/test.go | 11 +++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 76915fc..49b7e5d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: ${{ env.GO_VERSION }} - - run: cd /tmp && go install github.com/jjti/go-spanlint@${{ env.version }} && spanlint -h + - run: cd /tmp && go install github.com/jjti/go-spanlint/cmd/spanlint@${{ env.version }} && spanlint -h env: version: ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA || env.GITHUB_REF_SLUG }} diff --git a/spanlint.go b/spanlint.go index 8cb4d3d..5adcfab 100644 --- a/spanlint.go +++ b/spanlint.go @@ -235,8 +235,7 @@ func missingSpanCalls( switch n.(type) { case *ast.FuncLit: if len(stack) > 0 { - // return false // don't stray into nested functions - return true // don't stray into nested functions + return false // don't stray into nested functions } case nil: stack = stack[:len(stack)-1] // pop diff --git a/testdata/test.go b/testdata/test.go index 4f8f7ed..0942efa 100644 --- a/testdata/test.go +++ b/testdata/test.go @@ -132,6 +132,17 @@ func _() error { return nil } +func _() error { + _, span := otel.Tracer("foo").Start(context.Background(), "bar") + defer span.End() + + if true { + return nil + } + + return nil +} + func _() error { _, span := otel.Tracer("foo").Start(context.Background(), "bar") defer span.End()