Skip to content

Commit

Permalink
Merge pull request #23 from ldez/fix/ci
Browse files Browse the repository at this point in the history
chore: use GitHub Action
  • Loading branch information
kkHAIKE committed Mar 23, 2024
2 parents 82fe695 + 87e3db6 commit df8a0ab
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 58 deletions.
26 changes: 0 additions & 26 deletions .circleci/config.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Go Matrix
on: [push, pull_request]

jobs:

cross:
name: Go
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 0

strategy:
matrix:
go-version: [ oldstable, stable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
# https://github.com/marketplace/actions/checkout
- name: Checkout code
uses: actions/checkout@v4

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Test
run: go test -v -cover ./...

- name: Build
run: go build -v -ldflags "-s -w" -trimpath
44 changes: 44 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Main

on:
push:
branches:
- main
pull_request:

jobs:

main:
name: Main Process
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.57.0
CGO_ENABLED: 0

steps:
# https://github.com/marketplace/actions/checkout
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
go mod download
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
# https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}

- name: Make
run: make
32 changes: 0 additions & 32 deletions contextcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"go/token"
"go/types"
"regexp"
"strconv"
"strings"
"sync"

Expand Down Expand Up @@ -222,37 +221,6 @@ func (r *runner) collectHttpTyps(pssa *buildssa.SSA) {
}
}

func (r *runner) noImportedContextAndHttp(f *ssa.Function) (ret bool) {
if !f.Pos().IsValid() {
return false
}

file := analysisutil.File(r.pass, f.Pos())
if file == nil {
return false
}

if skip, has := r.skipFile[file]; has {
return skip
}
defer func() {
r.skipFile[file] = ret
}()

for _, impt := range file.Imports {
path, err := strconv.Unquote(impt.Path.Value)
if err != nil {
continue
}
path = analysisutil.RemoveVendor(path)
if path == ctxPkg || path == httpPkg {
return false
}
}

return true
}

func (r *runner) checkIsEntry(f *ssa.Function) (ret entryType) {
// if r.noImportedContextAndHttp(f) {
// return EntryNormal
Expand Down

0 comments on commit df8a0ab

Please sign in to comment.