I think a little more background about the context of the question would be helpful. Determinism may mean different things in different situations depending ont he guarantees you need. Also, did you know that the go playground (
play.golang.org) is intended to be generally deterministic so that output can be cached? That might be a good place for you to start. I have a few more general thoughts:
Is the code trusted or could it be "attacker" controller? There are going to be a lot of random execution delay differences on a modern multiprocessor, and they'd be noticeable to a goroutine calling time.Sleep in a loop especially if the program was not the only application on the physical host. Theoretically, you could use this as a random number generator and cause non-deterministic execution, but obviously that code would be quite weird and probably wouldn't make it past code review. But if the code is untrusted, you may have to worry about it.
Another thought is that goroutine scheduling is effectively non-deterministic on a multiprocessor (I don't know enough about the runtime to say whether this is true on a uniprocessor), so the runtime's scheduling algorithm (plus natural delays I mentioned above) can cause non-determinism to emerge. For example, depending on goroutine scheduling order, this code may sometimes crash:
https://go.dev/play/p/lEZEAYdji-f . As Axel said you will need to run it locally, the playground results may be cached iirc. I ran it 100 times and it crashed 9 times. This code is contrived, but in a large system this sort of non-determinism may still happen due to the general complexity of it all, and it may or may not matter to you.
Also, what exactly do you mean by "determinism"? Another example: if you create many goroutines in a loop and have them all do an atomic.AddInt64 on a shared variable (e.g. for them to get a global ID for themselves), the specific number each goroutine is assigned will essentially be random. The numbers will not form a continuous distribution, but they will be random at least in some sense on a multiprocessor. If the code does different things based on a combination of this kind of simple non-determinism, it can cause different code paths and different specific interleaving of the code in different executions. But, in practice it there may not be an observable effect in your average program, so I don't know if you consider this aspect important.
-Kevin