> if an environment variable (eg. GO_DISABLE_TELEMETRY=1) is not detected
It could also easily rely on whether the shell is attached to a tty to detect a CI environment, and disable telemetry by default in this case.
I mean, I completely agree with you in principle, but also there are a lot of terrible CI systems out there.
Now the team managing CI (or QA which could actually be in a TTY) needs to notice these failures and communicate them (via a JIRA ticket of course) back to the development team. That team doesn't know what it's about and sticks it on the backlog. Eventually they give the right environment variable, but environment variables are a security risk so it needs to go through security review, and because this mentions telemetry data the privacy and legal teams want sign-off...
This might be an exaggeration, but I think it's worth thinking about the worst case scenario when building things like this into development tools that are used so widely.
If you can't update an environment variable yourself, or ask directly someone who can, all that on a CI system that's somehow bound to TTY, get out of here.
Fixing this in several CI systems I've encountered would take well into months, plausibly with many unknown failures because of cached builds.