Luke got it right; as it turns out, this is the same bug as 
https://github.com/golang/go/issues/24456 
<https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgolang%2Fgo%2Fissues%2F24456&sa=D&sntz=1&usg=AFQjCNHmEChawliHplEb5PJE4lk0JWcTqw>
.

On Wednesday, March 21, 2018 at 12:58:37 PM UTC-7, lre...@uber.com wrote:
>
> On Tuesday, March 20, 2018 at 3:16:20 PM UTC-7, Akshay Shah wrote:
>>
>> Like many folks, I often embed version information (git hash, build time, 
>> etc) into Go binaries with linker flags. Before Go 1.10, this worked:
>>
>> go build -ldflags="-X 
>> github.com/user/top_level_project/vendor/github.com/user/version.Version=some_hash"
>>  github.com/user/top_level_project
>>
>> After Go 1.10, I’m having trouble amending this approach in a way that 
>> only busts the build cache for the vendored version package.
>>
>> go build -ldflags=all="-X 
>> github.com/user/top_level_project/vendor/github.com/user/version.Version=some_hash"
>>  github.com/user/top_level_project
>>
>> works, but rebuilds much more than necessary. A variety of alternatives 
>> to =all= haven’t worked as I expected.
>>
>> I’ve put together a small reproduction and a script showing the different 
>> approaches I’ve tried at github.com/akshayjshah/golink. Any suggestions 
>> would be very welcome!
>>
>> Cheers,
>> Akshay
>>
> Looks like this works:
>
> diff --git a/demo.sh b/demo.sh
> index 888a5df..83ab264 100644
> --- a/demo.sh
> +++ b/demo.sh
> @@ -36,3 +36,6 @@ demo
>
>
>  SCOPE="github.com/akshayjshah/golink/vendor/..."
>  demo
> +
> +SCOPE="github.com/akshayjshah/golink"
> +demo
>
> I can't tell if this intentional though. I'm also exploring this problem 
> in https://github.com/golang/go/issues/24456
>
> - Luke 
>
>> ​
>>
>

-- 
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