Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch causing go-steam not to build. #13

Closed
rjackson opened this issue Aug 26, 2014 · 4 comments · Fixed by #14
Closed

Type mismatch causing go-steam not to build. #13

rjackson opened this issue Aug 26, 2014 · 4 comments · Fixed by #14
Labels

Comments

@rjackson
Copy link

Hi there,

Excuse me if I'm blatantly incorrect - this endeavour was my first time writing any Go.

I've got a source file which is simply a Hello World, but loads in go-steam as my first ask after Hello World is going to be logging into a Steam account.

package mmstats_provider

import (
    "fmt"
    "github.com/Philipp15b/go-steam"
    "github.com/Philipp15b/go-steam/internal/steamlang"
    "io/ioutil"
    "log"
)

func main() {
    fmt.Println("Hello World")
}

When attempting to build this little bit of code, I got the following error:

../../Philipp15b/go-steam/auth.go:50: cannot use steamlang.EAccountType_Individual (type steamlang.EAccountType) as type int32 in argument to steamid.NewIdAdv

If I understand correctly, this is because EAccountType_Individual is of type EAccountType (which is based upon int32, but I guess Go is pretty strict about it's types), whereas steamid.NewIdAdv is expecting a regular int32 for a user's account type. I can workaround this for now by casting EAccountType_Individual to int32, but I think the correct solution is to change NewIdAdv to accept an EAccountType value for accountType instead of int32 - and at present I don't know how to do that (importing steamlang errored out because of circular imports).

Thanks,

@rjackson rjackson changed the title Type mismatch causing package not to build. Type mismatch causing go-steam not to build. Aug 26, 2014
gamingrobot added a commit to gamingrobot/go-steam that referenced this issue Aug 26, 2014
@Philipp15b
Copy link
Owner

Your analysis seems about right, but I am not seeing this error on go1.3 windows/amd64. What version of Go are you using? (go version command output). I'll merge #14 if it fixes the issue, but I'd like to solve that riddle first :)

Though I don't see how your program above compiles - there are unused imports which Go usually sees as a reason to abort compilation. Or did you shorten the example?

Regarding the suggestion to change the types to the proper steamlang types, it is indeed not possible since Go does not allow circular imports (steamlang also uses a bit of the steamid package).

@gamingrobot
Copy link
Contributor

I am on go1.3 linux/amd64 and I did not see the compilation issue but still did a pull request for the bug RJacksonm1 found.

@rjackson
Copy link
Author

I'm using go1.3.1 linux/amd64. I think you're right about my app not compiling - I do recall some errors about unused imports showing up, but I actually went to bed before I got the app to compile. I posted this issue as soon as I figured out how to resolve the error in go-steam.

I was also using the go build command, rather than go run - if that makes any difference.

@Philipp15b
Copy link
Owner

Interesting. I updated my Go installation to 1.3.1 and experienced the same issue as @RJacksonm1. I'll merge #14 then. Curious though - this should not happen with a bugfix release, should it?

Philipp15b added a commit that referenced this issue Aug 27, 2014
@Philipp15b Philipp15b added the bug label Aug 27, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants