Skip to content

Commit 49f6e83

Browse files
authored
Split Go bindings into separate module (#364)
1 parent 7eeefcf commit 49f6e83

File tree

13 files changed

+796
-349
lines changed

13 files changed

+796
-349
lines changed

.github/workflows/nix-checks.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,17 @@ jobs:
2121
- uses: DeterminateSystems/nix-installer-action@v21
2222
- uses: DeterminateSystems/magic-nix-cache-action@v13
2323
- run: nix build .#checks.x86_64-linux.${{ matrix.check }}
24+
25+
packages:
26+
runs-on: ubuntu-latest
27+
strategy:
28+
matrix:
29+
package:
30+
- scip
31+
- speedtest
32+
- proto-generate
33+
steps:
34+
- uses: actions/checkout@v6
35+
- uses: DeterminateSystems/nix-installer-action@v21
36+
- uses: DeterminateSystems/magic-nix-cache-action@v13
37+
- run: nix build .#${{ matrix.package }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ dist-newstyle/
2828

2929
# Nix output
3030
/result
31+
32+
vendor/

bindings/go/scip/go.mod

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
module github.com/sourcegraph/scip/bindings/go/scip
2+
3+
go 1.25.0
4+
5+
require (
6+
github.com/cockroachdb/errors v1.12.0
7+
github.com/fatih/color v1.18.0
8+
github.com/hexops/gotextdiff v1.0.3
9+
github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a
10+
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
11+
google.golang.org/protobuf v1.36.6
12+
)
13+
14+
require (
15+
github.com/google/go-cmp v0.7.0
16+
github.com/google/gofuzz v1.2.0
17+
github.com/hexops/autogold/v2 v2.3.1
18+
github.com/jedib0t/go-pretty/v6 v6.6.3
19+
github.com/sourcegraph/conc v0.3.0
20+
github.com/stretchr/testify v1.11.1
21+
pgregory.net/rapid v1.1.0
22+
)
23+
24+
require (
25+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
26+
github.com/cockroachdb/redact v1.1.5 // indirect
27+
github.com/davecgh/go-spew v1.1.1 // indirect
28+
github.com/getsentry/sentry-go v0.27.0 // indirect
29+
github.com/gogo/protobuf v1.3.2 // indirect
30+
github.com/hexops/valast v1.5.0 // indirect
31+
github.com/kr/pretty v0.3.1 // indirect
32+
github.com/kr/text v0.2.0 // indirect
33+
github.com/mattn/go-colorable v0.1.14 // indirect
34+
github.com/mattn/go-isatty v0.0.20 // indirect
35+
github.com/mattn/go-runewidth v0.0.15 // indirect
36+
github.com/nightlyone/lockfile v1.0.0 // indirect
37+
github.com/pkg/errors v0.9.1 // indirect
38+
github.com/pmezard/go-difflib v1.0.0 // indirect
39+
github.com/rivo/uniseg v0.2.0 // indirect
40+
github.com/rogpeppe/go-internal v1.14.1 // indirect
41+
go.uber.org/atomic v1.7.0 // indirect
42+
go.uber.org/multierr v1.9.0 // indirect
43+
golang.org/x/mod v0.33.0 // indirect
44+
golang.org/x/sync v0.19.0 // indirect
45+
golang.org/x/sys v0.41.0 // indirect
46+
golang.org/x/text v0.34.0 // indirect
47+
golang.org/x/tools v0.42.0 // indirect
48+
gopkg.in/yaml.v3 v3.0.1 // indirect
49+
mvdan.cc/gofumpt v0.9.2 // indirect
50+
)

bindings/go/scip/go.sum

Lines changed: 276 additions & 0 deletions
Large diffs are not rendered by default.

checks.nix

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
pname = "scip-bindings-go";
2828
inherit version;
2929
src = ./.;
30-
vendorHash = "sha256-JuGh7/CnpCWABK6WYE+Mo7P8X0glFrFa9ve9eO//1v8=";
30+
modRoot = "./bindings/go/scip";
31+
vendorHash = "sha256-pCYfH/CvzwCh13twl1Xq2Ma+jUNgFFrdGpQH+i3y6u8=";
32+
env.GOWORK = "off";
3133
buildTags = [ "asserts" ];
3234
subPackages = [
33-
"bindings/go/scip"
34-
"bindings/go/scip/internal"
35-
"bindings/go/scip/memtest"
36-
"bindings/go/scip/testutil"
35+
"."
36+
"internal"
37+
"memtest"
38+
"testutil"
3739
];
3840
preCheck = ''
3941
export SCIP_SAMPLE_INDEXES_DIR=${sampleIndexes}
@@ -66,8 +68,9 @@
6668
inherit version;
6769
src = ./.;
6870
modRoot = "./reprolang";
69-
vendorHash = "sha256-H6RLXmQsufwKtI5BujsUEibVuCMpILqtX3W0Wg9m3T8=";
71+
vendorHash = "sha256-tOTxbCRFjCJYfCrICY74mrh9Tfqzx/rG77MiZXrRRok=";
7072
proxyVendor = true;
73+
env.GOWORK = "off";
7174
buildInputs = [ pkgs.tree-sitter ];
7275
subPackages = [
7376
"grammar"

dev/publish-release.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ fi
3737
} >&2
3838

3939
TAG="v$NEW_VERSION"
40+
BINDINGS_TAG="bindings/go/scip/$TAG"
4041
git tag "$TAG"
41-
git push origin "$TAG"
42+
git tag "$BINDINGS_TAG"
43+
git push origin "$TAG" "$BINDINGS_TAG"
4244

4345
{
4446
echo "See the [CHANGELOG](https://github.com/sourcegraph/scip/blob/main/CHANGELOG.md) to see what's new in scip v$NEW_VERSION."

flake.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
inherit version;
2727

2828
src = ./.;
29-
vendorHash = "sha256-ywSR9yRysnm2E6kI8UJS6XcpuqKJF8wJpHcYS7TGmjI=";
29+
vendorHash = "sha256-ag3r00bqP1x+HX6o8W99RTmk/RARRCJIDloIYO6syOw=";
30+
proxyVendor = true;
3031

3132
subPackages = [ "cmd/scip" ];
3233

34+
env.GOWORK = "off";
3335
ldflags = [ "-X main.Reproducible=true" ];
3436

3537
meta = {
@@ -45,15 +47,19 @@
4547
inherit version;
4648

4749
src = ./.;
48-
vendorHash = "sha256-ywSR9yRysnm2E6kI8UJS6XcpuqKJF8wJpHcYS7TGmjI=";
50+
modRoot = "./bindings/go/scip";
51+
vendorHash = "sha256-pCYfH/CvzwCh13twl1Xq2Ma+jUNgFFrdGpQH+i3y6u8=";
52+
env.GOWORK = "off";
4953

50-
subPackages = [ "bindings/go/scip/speedtest" ];
54+
subPackages = [ "speedtest" ];
5155

5256
nativeBuildInputs = [ pkgs.makeWrapper ];
5357
postFixup = ''
5458
wrapProgram $out/bin/speedtest \
5559
--set SCIP_SAMPLE_INDEXES_DIR ${sampleIndexes}
5660
'';
61+
62+
meta.mainProgram = "speedtest";
5763
};
5864

5965
proto-generate =

go.mod

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,63 @@
11
module github.com/sourcegraph/scip
22

3-
go 1.24.1
3+
go 1.25.0
4+
5+
replace github.com/sourcegraph/scip/bindings/go/scip => ./bindings/go/scip
46

57
require (
68
github.com/bytedance/sonic v1.14.1
7-
github.com/cockroachdb/errors v1.8.9
8-
github.com/fatih/color v1.15.0
9-
github.com/google/go-cmp v0.6.0
10-
github.com/google/gofuzz v1.2.0
11-
github.com/hexops/autogold/v2 v2.2.1
12-
github.com/hexops/gotextdiff v1.0.3
9+
github.com/cockroachdb/errors v1.12.0
1310
github.com/hhatto/gocloc v0.4.2
14-
github.com/jedib0t/go-pretty/v6 v6.6.3
1511
github.com/k0kubun/pp/v3 v3.1.0
1612
github.com/klauspost/compress v1.18.0
1713
github.com/montanaflynn/stats v0.7.1
18-
github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a
19-
github.com/sourcegraph/conc v0.3.0
20-
github.com/stretchr/testify v1.10.0
14+
github.com/sourcegraph/scip/bindings/go/scip v0.0.0-00010101000000-000000000000
15+
github.com/stretchr/testify v1.11.1
2116
github.com/urfave/cli/v2 v2.25.7
22-
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
17+
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
2318
google.golang.org/protobuf v1.36.6
24-
pgregory.net/rapid v1.1.0
2519
zombiezen.com/go/sqlite v1.0.0
2620
)
2721

2822
require (
2923
github.com/bytedance/gopkg v0.1.3 // indirect
3024
github.com/bytedance/sonic/loader v0.3.0 // indirect
3125
github.com/cloudwego/base64x v0.1.6 // indirect
32-
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f // indirect
33-
github.com/cockroachdb/redact v1.1.3 // indirect
26+
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
27+
github.com/cockroachdb/redact v1.1.5 // indirect
3428
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
3529
github.com/davecgh/go-spew v1.1.1 // indirect
3630
github.com/dustin/go-humanize v1.0.1 // indirect
37-
github.com/getsentry/sentry-go v0.12.0 // indirect
31+
github.com/fatih/color v1.18.0 // indirect
32+
github.com/getsentry/sentry-go v0.27.0 // indirect
3833
github.com/go-enry/go-enry/v2 v2.7.2 // indirect
3934
github.com/go-enry/go-oniguruma v1.2.1 // indirect
4035
github.com/gogo/protobuf v1.3.2 // indirect
36+
github.com/google/go-cmp v0.7.0 // indirect
4137
github.com/google/uuid v1.6.0 // indirect
42-
github.com/hexops/valast v1.4.4 // indirect
38+
github.com/hexops/autogold/v2 v2.3.1 // indirect
39+
github.com/hexops/gotextdiff v1.0.3 // indirect
4340
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
4441
github.com/kr/pretty v0.3.1 // indirect
4542
github.com/kr/text v0.2.0 // indirect
46-
github.com/mattn/go-colorable v0.1.13 // indirect
43+
github.com/mattn/go-colorable v0.1.14 // indirect
4744
github.com/mattn/go-isatty v0.0.20 // indirect
48-
github.com/mattn/go-runewidth v0.0.15 // indirect
4945
github.com/ncruces/go-strftime v0.1.9 // indirect
50-
github.com/nightlyone/lockfile v1.0.0 // indirect
5146
github.com/pkg/errors v0.9.1 // indirect
5247
github.com/pmezard/go-difflib v1.0.0 // indirect
5348
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
54-
github.com/rivo/uniseg v0.2.0 // indirect
55-
github.com/rogpeppe/go-internal v1.13.1 // indirect
49+
github.com/rogpeppe/go-internal v1.14.1 // indirect
5650
github.com/russross/blackfriday/v2 v2.1.0 // indirect
51+
github.com/sourcegraph/beaut v0.0.0-20240611013027-627e4c25335a // indirect
5752
github.com/spf13/afero v1.10.0 // indirect
5853
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
5954
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
60-
go.uber.org/multierr v1.11.0 // indirect
6155
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
62-
golang.org/x/mod v0.28.0 // indirect
63-
golang.org/x/sync v0.17.0 // indirect
64-
golang.org/x/sys v0.36.0 // indirect
65-
golang.org/x/text v0.29.0 // indirect
66-
golang.org/x/tools v0.37.0 // indirect
56+
golang.org/x/sys v0.41.0 // indirect
57+
golang.org/x/text v0.34.0 // indirect
6758
gopkg.in/yaml.v3 v3.0.1 // indirect
6859
modernc.org/libc v1.41.0 // indirect
6960
modernc.org/mathutil v1.6.0 // indirect
7061
modernc.org/memory v1.7.2 // indirect
7162
modernc.org/sqlite v1.27.0 // indirect
72-
mvdan.cc/gofumpt v0.5.0 // indirect
7363
)

0 commit comments

Comments
 (0)