Thanks, yes, I had checked out `go work sync`. I still don't understand 
what it means with "update the modules withing a workspace" though, or what 
this command does. I wish the documentation was more concrete (which files 
it changes, who uses those files, or maybe an example). `go help work sync` 
has a longer description, but I still don't know what it means by 
"workspace's build list". But I don't use workspaces often, so I may be 
missing something obvious.

Anyway I tried `go work sync`, and it doesn't seem to do anything in my 
scenario -- I didn't notice any files changed by it: 

```
$ cd work/a
$ go work sync
$ cat go.work
go 1.20

use (
        .
        /home/janpf/work/b
)
$ cat go.mod
module github.com/joe/a

go 1.20
$ go get
github.com/joe/a imports
        github.com/joe/b: cannot find module providing package 
github.com/joe/b
$ go version
go version go1.20.5 linux/amd64
```

ps.: ToTK seems dangerous! :)
On Tuesday, July 11, 2023 at 10:45:21 PM UTC+2 Howard C. Shaw III wrote:

> Also did you call go work sync? I think that might be what I actually use 
> in place of go mod tidy. Sorry, ToTK has been absorbing my free time, so it 
> has been a while since I worked on the audio project where I used 
> workspaces.
>
> https://github.com/golang/go/issues/50750
>
> "*bcmills <https://github.com/bcmills> *commented on Jul 25, 2022 
> <https://github.com/golang/go/issues/50750#issuecomment-1194322256>
>
> go mod tidy is intended to update the module's self-contained 
> dependencies. It doesn't use the workspace because in general one may work 
> on multiple independently-maintained modules in the same workspace, and if 
> you're preparing an upstream commit you definitely don't want that commit 
> to rely on unpublished local modifications.
>
> go work sync is intended to update the modules within a workspace to 
> reflect the dependencies selected in that workspace. That is probably what 
> you want if you are working on a set of modules that are all maintained as 
> a single unit."
> It seems like currently you are basically forced to use 'go work sync' to 
> update dependencies when using workspaces, and not use 'go mod tidy' or a 
> bare 'go get'.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d90a22be-913c-433b-8fc6-6efb17f0f2f4n%40googlegroups.com.

Reply via email to