Closed sljm12 closed 4 years ago
@sljm12 thanks for posting this! I am coming in on some of the Go SDK maintenance and I can look into this issue.
I have run into the same issue with:
../../../go/pkg/mod/github.com/watson-developer-cloud/go-sdk@v1.5.0/naturallanguageunderstandingv1/natural_language_understanding_v1.go:75:41: not enough arguments in call to core.NewBaseService
have (*core.ServiceOptions)
want (*core.ServiceOptions, string, string)
../../../go/pkg/mod/github.com/watson-developer-cloud/go-sdk@v1.5.0/toneanalyzerv3/tone_analyzer_v3.go:75:41: not enough arguments in call to core.NewBaseService
have (*core.ServiceOptions)
want (*core.ServiceOptions, string, string)
Same idea on the above seems to resolve as they are both missing two parameters.
Ok I have done some digging into this and I have some follow up questions:
@sljm12 it looks like you have manually specified a version of the Go SDK Core that is pretty outdated, but you are using the current version of the Go SDK. The version of the Core 1.1.0
does indeed accept 3 parameters for NewBaseService
, but that changed in subsequent major releases of the core to be a method that only accepts one parameter:
https://github.com/IBM/go-sdk-core/blob/master/v4/core/base_service.go#L69
If you only add the Go SDK as a dependency to your project using go get -u github.com/watson-developer-cloud/go-sdk@v1.5.0
, it should specify the correct version of the Core that it needs in your project's go.mod
.
To test this, I initialized an empty project and only ran go get -u github.com/watson-developer-cloud/go-sdk@v1.5.0
. Then when I built the project, it imported the correct version of the Core for me. The result was:
module example.com/go-test
go 1.13
require (
github.com/IBM/go-sdk-core v0.0.0-20200217212347-fe152a0e9e89
github.com/watson-developer-cloud/go-sdk v1.5.0
)
I then pasted your code into the main.go
and was able to compile the binary. Can you try this and see if it resolves your issue without having to change the core parameters?
@vsential similar to the description above, can you check what version of the Core you are using and see if the resolution above helps?
Closing as I haven't heard back. I hope this addressed the issue!
Remember, an issue is not the place to ask questions. If you have issues with the APIs or have a question about the Watson services, see Stack Overflow.
Before you open an issue, please check if a similar issue already exists or has been closed before.
Check service status
Overview What is the issue? Be concise and clear. Compilation failed
Expected behavior What did you expect to happen? Compilation to succeed
Actual behavior What actually happened? During go build the following error was produced.
go\pkg\mod\github.com\watson-developer-cloud\go-sdk@v1.5.0\languagetranslatorv3\language_translator_v3.go:72:41: not enough arguments in call to core.NewBaseService have (core.ServiceOptions) want (core.ServiceOptions, string, string)
How to reproduce Help us to reproduce what you experienced. Include your code snippets (without credentials) go get -u github.com/IBM/go-sdk-core/... go get -u github.com/watson-developer-cloud/go-sdk@v1.5.0
----- Code ------ package main
import ( "fmt"
)
func main() {
}
Screenshots If applicable, add screenshots to help explain your problem.
SDK Version Please provide the SDK version here. github.com/IBM/go-sdk-core v1.1.0 github.com/watson-developer-cloud/go-sdk@v1.5.0
Additional information:
Windows 10
Go
are you using? go 1.14.3Additional context Add any other details about the problem.
I have checked code in language_translator_v3.go
On line 72 the call to baseService, err := core.NewBaseService(serviceOptions) was missing 2 parameters.
I have replace the line with baseService, err := core.NewBaseService(serviceOptions, DefaultServiceName, "")
and it compiles and executed successfully.