Glide: Fails when an invalid file is encountered

Created on 9 Jun 2016  路  3Comments  路  Source: Masterminds/glide

Hi

It failed to create the package file because it encountered an invalid go file.

I guess its not required to fail so strongly.

$ go version
go version go1.6.2 linux/amd64
$ glide -v
glide version 0.10.2-86-g5865b8e
$ ll 
total 8
drwxrwxr-x 2 mh-cbon mh-cbon 4096  9 juin  14:00 git
-rw-rw-r-- 1 mh-cbon mh-cbon   34  9 juin  14:00 main.go
-rw-rw-r-- 1 mh-cbon mh-cbon    0  9 juin  14:00 README.md
$ ll git/
total 0
-rw-rw-r-- 1 mh-cbon mh-cbon 0  9 juin  14:00 index.go
$ cat git/index.go 
$ glide create
[INFO]  Generating a YAML configuration file and guessing the dependencies
[INFO]  Attempting to import from other package managers (use --skip-import to skip)
[ERROR] Failed to build an initial list of packages to scan: git/index.go:1:1: expected 'package', found 'EOF'
[ERROR] Error resolving local dependencies: git/index.go:1:1: expected 'package', found 'EOF'

hth

bug

All 3 comments

We should provide a message but we may not need to fail so strongly.

I've been musing on this issue a lot recently, since I've been working on the static analysis piece in vsolver. Deciding what's best to do when static analysis encounters a problem (which may or may not mean that the code won't compilable) is a big question.

My thoughts so far, in rough order:

  • The key to keeping this sane is being able to correctly categorize static analysis failures. Such categorization would let us decide whether it's safe to proceed or not.
  • It's important to remember that most Go tooling works so well and smoothly because it only operates on well-formed code. Dragons await when you step off the island of requiring syntactic validity.
  • If possible, it's probably good to be a little more lenient with errors in the main project. Doing so could make things a LOOOT better for users.
  • If there are errors in statically analyzing deps, though, that's pretty much cause for trying another version of that dep (or an abort); otherwise, we're knowingly pulling in broken code that the user doesn't necessarily own.

I've had a few offline conversations on this. Moving and changes to 0.13 since in involves gps and it's still under debate.

Was this page helpful?
0 / 5 - 0 ratings