-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The actual fix is relatively simple (we moved the shared libraries to /deps and made /deps a go package). To prevent accidental breakage in the future I also added a test.
- Loading branch information
1 parent
4629528
commit 085490d
Showing
12 changed files
with
59 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Package deps exists because shared libraries must be in the same directory | ||
// as a go package for `go mod vendor` to work. | ||
// (c.f. https://github.com/golang/go/issues/26366#issuecomment-405683150) | ||
package deps | ||
|
||
/* | ||
#cgo LDFLAGS: -L${SRCDIR} | ||
#cgo darwin,arm64 LDFLAGS: -lautomerge_core_darwin_arm64 | ||
#cgo darwin,amd64 LDFLAGS: -lautomerge_core_darwin_amd64 | ||
#cgo linux,arm64 LDFLAGS: -lautomerge_core_linux_arm64 -lm | ||
#cgo linux,amd64 LDFLAGS: -lautomerge_core_linux_amd64 -lm | ||
*/ | ||
import "C" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package deps | ||
|
||
import "os" | ||
import "os/exec" | ||
import "testing" | ||
|
||
func TestVendored(t *testing.T) { | ||
os.Chdir("vendor_test") | ||
|
||
run := func(c string, args ...string) { | ||
cmd := exec.Command(c, args...) | ||
output, err := cmd.CombinedOutput() | ||
if err != nil { | ||
os.Stdout.Write(output) | ||
t.Fatal(err) | ||
} | ||
} | ||
|
||
run("go", "mod", "tidy") | ||
run("go", "mod", "vendor") | ||
run("go", "test") | ||
run("git", "checkout", "go.mod") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
go.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
go 1.19 | ||
|
||
module github.com/automerge/vendor-test | ||
|
||
require github.com/automerge/automerge-go v0.0.0 | ||
replace github.com/automerge/automerge-go => ../../ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package main | ||
|
||
import "github.com/automerge/automerge-go" | ||
import "testing" | ||
|
||
func TestWorking(t *testing.T) { | ||
automerge.New() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters