Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Global state: internal/gps/internal/internal.go var IsStdLib #597

Closed
jmank88 opened this issue May 17, 2017 · 1 comment
Closed

Global state: internal/gps/internal/internal.go var IsStdLib #597

jmank88 opened this issue May 17, 2017 · 1 comment

Comments

@jmank88
Copy link
Collaborator

jmank88 commented May 17, 2017

internal/gps/internal/internal.go contains a global function variable IsStdLib, for swapping in alternative test implementations.

  1. This seems brittle, particularly for tests executed in parallel. Is there a compelling reason to leave this global variable as is? Or would it be worth exploring alternatives, like injecting the function?

  2. This variable and function are the sole members of package internal, which is a bit irregular in any case. Regardless of (1), should these be moved elsewhere? (up to gps if the nested internal is now redundant? or into a new sub-package?)

@sdboyer
Copy link
Member

sdboyer commented May 17, 2017

This seems brittle, particularly for tests executed in parallel. Is there a compelling reason to leave this global variable as is? Or would it be worth exploring alternatives, like injecting the function?

Quite agreed - see the discussion in the PR that originally introduced it, sdboyer/gps#189. This was a "good enough for now" hack. If we can find a more elegant way of doing it, then great. (Honestly, the func itself is kind of a nasty hack IMO, but it's what the toolchain currently does, so...)

This variable and function are the sole members of package internal, which is a bit irregular in any case. Regardless of (1), should these be moved elsewhere? (up to gps if the nested internal is now redundant? or into a new sub-package?)

It's still out of scope for anything not in gps to be touching it, so let's keep it doubly-internal. But yeah, it's definitely wrong to have it directly in internal; a subpackage therein would be good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants