Skip to content

Commit

Permalink
workflows: fix golangci-lint test failed.
Browse files Browse the repository at this point in the history
include file can't found when used CGO.

Running [/home/runner/golangci-lint-1.56.2-linux-amd64/golangci-lint run --out-format=github-actions --disable-all -E errcheck] in [] ...
  Error: could not import github.com/jschwinger233/elibpcap (-: # github.com/jschwinger233/elibpcap
  Error: ../../../go/pkg/mod/github.com/jschwinger233/elibpcap@v0.0.0-20231010035657-e99300096f5e/compile.go:15:10: fatal error: 'pcap.h' file not found
  #include <pcap.h>
           ^~~~~~~~
  1 error generated.) (typecheck)

  Error: issues found
  Ran golangci-lint in 7752ms

Signed-off-by: CFC4N <cfc4n.cs@gmail.com>
  • Loading branch information
cfc4n committed Feb 25, 2024
1 parent caf561f commit 2127596
Showing 1 changed file with 6 additions and 36 deletions.
42 changes: 6 additions & 36 deletions .github/workflows/go-c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-9 clang-9 linux-tools-common linux-tools-generic gcc
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
Expand All @@ -33,29 +33,14 @@ jobs:
make clean
make env
make nocore -j4
cd ./lib/libpcap/ && sudo make install
cd $GITHUB_WORKSPACE
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v3.2.0

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --disable-all -E errcheck

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
- name: Build NOCORE
run: |
Expand All @@ -75,7 +60,7 @@ jobs:
- name: Install Compilers
run: |
sudo apt-get update
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic
sudo apt-get install --yes build-essential pkgconf libelf-dev llvm-14 clang-14 linux-tools-common linux-tools-generic gcc
for tool in "clang" "llc" "llvm-strip"
do
sudo rm -f /usr/bin/$tool
Expand All @@ -91,29 +76,14 @@ jobs:
make clean
make env
make -j8
cd ./lib/libpcap/ && sudo make install
cd $GITHUB_WORKSPACE
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v3.2.0

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --disable-all -E errcheck

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the all caching functionality will be complete disabled,
# takes precedence over all other caching options.
skip-cache: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
- name: Build NOCORE
run: |
Expand Down

0 comments on commit 2127596

Please sign in to comment.