How should one go about upgrading the nakama-runtime used in a project?
before I start the upgrade, I have a working dev environment using the gist @novabyte provided.
here is my dockerfile:
FROM heroiclabs/nakama-pluginbuilder:2.11.1 AS builder
ENV GO111MODULE on
ENV CGO_ENABLED 1
WORKDIR /backend
COPY . .
RUN go build --trimpath --mod=vendor --buildmode=plugin -o ./backend.so
FROM heroiclabs/nakama:2.11.1
COPY --from=builder /backend/backend.so /nakama/data/modules
here is my go.mod file:
module gitlab.com/Mahdad-Baghani/davaa
go 1.14
require github.com/heroiclabs/nakama-common v1.4.0
modules.txt
# github.com/golang/protobuf v1.3.5
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/timestamp
github.com/golang/protobuf/ptypes/wrappers
# github.com/heroiclabs/nakama-common v1.4.0
## explicit
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
github.com/heroiclabs/nakama-common/runtime
I wanted to do an upgrade by getting the latest version of the nakama-runtime (1.8.0 at the time) using the github documentation > Using this Go package > step 3:
go get -u "github.com/heroiclabs/nakama-common/runtime"
go mod vendor
here are my files after running these commands:
go.mod:
module gitlab.com/Mahdad-Baghani/davaa
go 1.14
require (
github.com/golang/protobuf v1.4.3 // indirect
github.com/heroiclabs/nakama-common v1.8.0
google.golang.org/grpc v1.27.1 // indirect
)
modules.txt:
# github.com/golang/protobuf v1.4.3
## explicit
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/timestamp
github.com/golang/protobuf/ptypes/wrappers
# github.com/heroiclabs/nakama-common v1.8.0
## explicit
github.com/heroiclabs/nakama-common/api
github.com/heroiclabs/nakama-common/rtapi
github.com/heroiclabs/nakama-common/runtime
# google.golang.org/grpc v1.27.1
## explicit
# google.golang.org/protobuf v1.25.0
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
google.golang.org/protobuf/internal/descfmt
google.golang.org/protobuf/internal/descopts
google.golang.org/protobuf/internal/detrand
google.golang.org/protobuf/internal/encoding/defval
google.golang.org/protobuf/internal/encoding/messageset
google.golang.org/protobuf/internal/encoding/tag
google.golang.org/protobuf/internal/encoding/text
google.golang.org/protobuf/internal/errors
google.golang.org/protobuf/internal/fieldsort
google.golang.org/protobuf/internal/filedesc
google.golang.org/protobuf/internal/filetype
google.golang.org/protobuf/internal/flags
google.golang.org/protobuf/internal/genid
google.golang.org/protobuf/internal/impl
google.golang.org/protobuf/internal/mapsort
google.golang.org/protobuf/internal/pragma
google.golang.org/protobuf/internal/set
google.golang.org/protobuf/internal/strs
google.golang.org/protobuf/internal/version
google.golang.org/protobuf/proto
google.golang.org/protobuf/reflect/protoreflect
google.golang.org/protobuf/reflect/protoregistry
google.golang.org/protobuf/runtime/protoiface
google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/known/timestamppb
google.golang.org/protobuf/types/known/wrapperspb
but I get the following error on recompiling:
"msg":"Could not open Go module","path":"/nakama/data/modules/backend.so","error":"plugin.Open(\"/nakama/data/modules/backend\"): plugin was built with a different version of package github.com/golang/protobuf/proto","stacktrace":"github.com/heroiclabs/nakama/v2/server.openGoModule\n\tgithub.com/heroiclabs/nakama/v2/server/runtime_go.go:2057\ngithub.com/heroiclabs/nakama/v2/server.NewRuntimeProviderGo\n\tgithub.com/heroiclabs/nakama/v2/server/runtime_go.go:1971\ngithub.com/heroiclabs/nakama/v2/server.NewRuntime\n\tgithub.com/heroiclabs/nakama/v2/server/runtime.go:465\nmain.main\n\tmain.go:130\nruntime.main\n\truntime/proc.go:203"}
I have used the following commands from this issue which changes go.mod but has no effect on solving the problem:
env GO111MODULE=on go clean -modcache
env GO111MODULE=on go mod tidy
go.mod:
module gitlab.com/Mahdad-Baghani/davaa
go 1.14
require (
github.com/golang/protobuf v1.4.3 // indirect
github.com/heroiclabs/nakama-common v1.8.0
)
What should I be doing?