diff --git a/cmd/1pl/interpreter.go b/cmd/1pl/interpreter.go index 9bf5c64..48e6469 100644 --- a/cmd/1pl/interpreter.go +++ b/cmd/1pl/interpreter.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/axone-protocol/prolog" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2" + "github.com/axone-protocol/prolog/v2/engine" "io" ) diff --git a/cmd/1pl/main.go b/cmd/1pl/main.go index 20ec6e8..250fe02 100644 --- a/cmd/1pl/main.go +++ b/cmd/1pl/main.go @@ -16,8 +16,8 @@ import ( "golang.org/x/crypto/ssh/terminal" - "github.com/axone-protocol/prolog" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2" + "github.com/axone-protocol/prolog/v2/engine" ) const ( diff --git a/examples/call_go_from_prolog/main.go b/examples/call_go_from_prolog/main.go index e96a8e8..d1ecf3f 100644 --- a/examples/call_go_from_prolog/main.go +++ b/examples/call_go_from_prolog/main.go @@ -4,8 +4,8 @@ import ( "fmt" "net/http" - "github.com/axone-protocol/prolog" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2" + "github.com/axone-protocol/prolog/v2/engine" ) func main() { diff --git a/examples/dcg/main.go b/examples/dcg/main.go index 03938ec..7ef0c76 100644 --- a/examples/dcg/main.go +++ b/examples/dcg/main.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/axone-protocol/prolog" + "github.com/axone-protocol/prolog/v2" ) // This example explains how to parse a simple English sentence with DCG (Definite Clause Grammar). diff --git a/examples/embed_prolog_into_go/main.go b/examples/embed_prolog_into_go/main.go index c54a7f6..79e30e8 100644 --- a/examples/embed_prolog_into_go/main.go +++ b/examples/embed_prolog_into_go/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/axone-protocol/prolog" + "github.com/axone-protocol/prolog/v2" ) // http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/cut.html diff --git a/examples/hanoi/main.go b/examples/hanoi/main.go index 08e1097..c18b683 100644 --- a/examples/hanoi/main.go +++ b/examples/hanoi/main.go @@ -4,8 +4,8 @@ import ( "flag" "fmt" - "github.com/axone-protocol/prolog" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2" + "github.com/axone-protocol/prolog/v2/engine" ) func main() { diff --git a/examples/initialization/main.go b/examples/initialization/main.go index 7807681..f4c29b9 100644 --- a/examples/initialization/main.go +++ b/examples/initialization/main.go @@ -4,7 +4,7 @@ import ( _ "embed" "os" - "github.com/axone-protocol/prolog" + "github.com/axone-protocol/prolog/v2" ) //go:embed hello.pl diff --git a/examples/sandboxing/main.go b/examples/sandboxing/main.go index 6886340..05e8eb9 100644 --- a/examples/sandboxing/main.go +++ b/examples/sandboxing/main.go @@ -2,9 +2,9 @@ package main import ( "fmt" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2/engine" - "github.com/axone-protocol/prolog" + "github.com/axone-protocol/prolog/v2" ) func main() { diff --git a/go.mod b/go.mod index 4e2b714..39e85f5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/axone-protocol/prolog +module github.com/axone-protocol/prolog/v2 go 1.23 diff --git a/interpreter.go b/interpreter.go index 6a82238..b1683ca 100644 --- a/interpreter.go +++ b/interpreter.go @@ -9,7 +9,7 @@ import ( "os" "strings" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2/engine" ) //go:embed bootstrap.pl diff --git a/interpreter_test.go b/interpreter_test.go index 2cfd796..50a88d4 100644 --- a/interpreter_test.go +++ b/interpreter_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2/engine" "github.com/stretchr/testify/assert" ) diff --git a/scripts/bump-module.sh b/scripts/bump-module.sh new file mode 100755 index 0000000..ca2f41b --- /dev/null +++ b/scripts/bump-module.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -eo pipefail + +major_version=$(cut -d. -f1 < version) + +if [ "${major_version}" -gt 1 ]; then + module_name=$(go mod edit -json | jq -r '.Module.Path') + module_name_unversioned=$(echo "${module_name}" | sed -E 's|/v[0-9]+$||') + module_name_versioned="${module_name_unversioned}/v${major_version}" + echo "🔬 major version detected, updating module path to ${module_name_versioned}" + + go mod edit -module "${module_name_versioned}" + echo "✅ module name updated to ${module_name_versioned} in go.mod" + + if [ "$(uname)" = "Darwin" ]; then + find . -type f -name "*.go" -exec \ + sed -i '' "s|\"${module_name}|\"${module_name_versioned}|g" {} \; + else + find . -type f -name "*.go" -exec \ + sed -i "s|\"${module_name}|\"${module_name_versioned}|g" {} \; + fi + echo "✅ packages updated to ${module_name_versioned} in source files" + + echo "🧹 cleaning up go.sum" + go mod tidy +else + echo "🙅version is not greater than 1, no need to update module path" +fi diff --git a/solutions.go b/solutions.go index 6c67c58..7fa23dd 100644 --- a/solutions.go +++ b/solutions.go @@ -7,7 +7,7 @@ import ( "reflect" "strings" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2/engine" ) // ErrClosed indicates the Solutions are already closed and unable to perform the operation. diff --git a/solutions_test.go b/solutions_test.go index 3f0140c..b52d148 100644 --- a/solutions_test.go +++ b/solutions_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/axone-protocol/prolog/engine" + "github.com/axone-protocol/prolog/v2/engine" "github.com/stretchr/testify/assert" ) diff --git a/version b/version new file mode 100644 index 0000000..359a5b9 --- /dev/null +++ b/version @@ -0,0 +1 @@ +2.0.0 \ No newline at end of file