golang / sublime-config

A library for Go environment configuration in Sublime Text
BSD 3-Clause "New" or "Revised" License
86 stars 24 forks source link

Improve error message when $GOPATH refers to missing directories #4

Closed jbuberel closed 8 years ago

jbuberel commented 8 years ago

The $GOPATH validation should differentiate between these two cases:

  1. The $GOPATH environment variable was not defined at all or contains invalid characters (is broken)
  2. One (or more) elements in the $GOPATH could not be resolved to directories in the local filesystem.

In the case of 2, the message should be something like "There was an error parsing your $GOPATH. One or more directories could not be found."

wbond commented 8 years ago

Right now the differentiation is not exposed via the API. golangconfig prints a warning to the console when part of GOPATH or GOROOT can not be found on the filesystem. However, if the setting is not present or effectively not present by pointing to a bad value, golangconfig always returns None.

The end-user message would be changed in Golang Build, but it sounds like we should possibly add an exception to be thrown when GOPATH or GOROOT have values that are invalid.

jbuberel commented 8 years ago

If being able to differentiate between those two conditions is that much work, I suggest we make the error message more general:

"Unable to configure your $GOPATH. Please make sure the value is set and that it only contains references to valid filesystem paths."

wbond commented 8 years ago

I don't think it is too much work, just explaining what the current checks are and how the error is displayed now.

I'll work on a CL for sublime-config to raise an new exception type if a defined GOPATH can't be found, and another CL for sublime-build to handle that.

jbuberel commented 8 years ago

Verified - working nicely in 0.9.0 release.