}
// Reset the state to a clean state.
- oldstate := setState(state{})
+ oldstate := setState(State{})
ForceUseModules = true
// Load in workspace mode.
// Reset clears all the initialized, cached state about the use of modules,
// so that we can start over.
func Reset() {
- setState(state{})
+ setState(State{})
}
-func setState(s state) state {
- oldState := state{
+func setState(s State) State {
+ oldState := State{
initialized: initialized,
forceUseModules: ForceUseModules,
rootMode: RootMode,
return oldState
}
-type state struct {
+type State struct {
initialized bool
forceUseModules bool
rootMode Root
modfetchState modfetch.State
}
+func NewState() *State { return &State{} }
+
+var LoaderState = NewState()
+
// Init determines whether module mode is enabled, locates the root of the
// current module (if any), sets environment variables for Git subprocesses, and
// configures the cfg, codehost, load, modfetch, and search packages for use