Skip to content

Commit

Permalink
refactor: enhance kcl-go cgo build tags (#368)
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy authored Aug 12, 2024
1 parent 0a84634 commit 4d139c4
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
with:
go-version: 1.22

- name: CGO_ENABLED=0 go test
run: CGO_ENABLED=0 go test ./...

- name: CGO_ENABLED=1 go test
run: CGO_ENABLED=1 go test ./...

# Parallel tests
- run: go test -v -coverprofile=profile.cov ./...
- uses: shogo82148/actions-goveralls@v1
Expand Down
3 changes: 3 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package kcl_test

import (
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !rpc
// +build !rpc
//go:build cgo
// +build cgo

package main

Expand Down
3 changes: 3 additions & 0 deletions kcl_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package kcl_test

import (
Expand Down
4 changes: 2 additions & 2 deletions pkg/kcl/api_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !rpc
// +build !rpc
//go:build !rpc && cgo
// +build !rpc,cgo

package kcl

Expand Down
4 changes: 2 additions & 2 deletions pkg/kcl/rpc_service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build rpc
// +build rpc
//go:build rpc || !cgo
// +build rpc !cgo

package kcl

Expand Down
4 changes: 2 additions & 2 deletions pkg/kcl/service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !rpc
// +build !rpc
//go:build !rpc && cgo
// +build !rpc,cgo

package kcl

Expand Down
3 changes: 3 additions & 0 deletions pkg/native/loader.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build cgo
// +build cgo

package native

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package plugin

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/api_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package plugin

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/error.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package plugin

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/hello_plugin/api.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package hello_plugin

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/hello_plugin/api_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package hello_plugin

import (
Expand Down
4 changes: 4 additions & 0 deletions pkg/plugin/spec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Copyright The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package plugin

import (
Expand Down
3 changes: 3 additions & 0 deletions pkg/plugin/utils_c_string.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright 2023 The KCL Authors. All rights reserved.

//go:build cgo
// +build cgo

package plugin

// #include <stdlib.h>
Expand Down

0 comments on commit 4d139c4

Please sign in to comment.