For poor souls like me getting this error (right on "package" instruction) in JetBrains IDE with Go linter plugin on Windows for completely valid imports, check line separators of file. I believe diff tool needed for goimports linter have problems with CRLF. After converting to LF all was fine.