Hi Robert,

Just to echo what Sam said, there is a healthy chance this could be 
explained by a version mismatch, although maybe it could be something else.

When you enable modules, by default it will look for the latest valid 
semver tag (https://semver.org) to satisfy any dependencies. For example, 
from the 'go' command documentation:

----------------------------------------------------------------------
https://golang.org/cmd/go/#hdr-Module_aware_go_get
----------------------------------------------------------------------
For each named package or package pattern, get must decide which version of 
the corresponding module to use. By default, get chooses the latest tagged 
release version, such as v0.4.5 or v1.2.3. If there are no tagged release 
versions, get chooses the latest tagged prerelease version, such as 
v0.0.1-pre1. If there are no tagged versions at all, get chooses the latest 
known commit.
----------------------------------------------------------------------

If you haven't already, I would recommend running 'go list -m all' to view 
the final versions that will be used in your build for all direct and 
indirect dependencies, and ideally share the results back here.  

Could you share the exact line of code that the compiler seems to be 
complaining about?  What package is 'random.go' in?  Is there a second 
package involved on the line of code that is triggering the compile error 
(and if so, what is the name of the second package)?

One possible explanation could be that some second package has a version 
under modules with a semver tag, whereas in GOPATH mode you might be ending 
up with a different version of that second package (e.g., you might be 
getting the latest commit in master in GOPATH mode, or perhaps you have an 
older version sitting in your GOPATH, etc.), and those two versions might 
not be compatible.

Best,
--thepudds


On Wednesday, December 26, 2018 at 7:05:57 AM UTC-5, Robert Recchia wrote:
>
> and the repo that is failing is my own repo where we do not use 
> versions/releases 
>
> On Tuesday, 25 December 2018 20:22:22 UTC-5, Robert Recchia wrote:
>>
>> I have been testing out the new go modules feature.  Our application 
>> compiles/installs without problems using the normal $GOPATH way and have 
>> been using this for a while now.   trying go modules produces the same 
>> error over and over 
>>
>> Steps I followed
>>
>> unset $GOPATH just to be safe 
>>
>> 1) git clone github project 
>>
>> 2) go mod init 
>>
>> 3) go build 
>>
>>
>> and after some output where I can see it getting all the dependencies I 
>> keep getting 
>>
>> random.go:14:10: assignment mismatch: 2 variables but 1 values
>> random.go:29:10: assignment mismatch: 2 variables but 1 values
>>
>> Again reverting back to the normal $GOPATH way everything compiles fine 
>> and I can start the binary. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to