Skip to content

the importfile function, src/cmd/gc/lex.c, will always fail for windows fully qualified file names #732

@jpoirier

Description

@jpoirier
What steps will reproduce the problem?
1. attempting to import a local package on windows

What is the expected output? What do you see instead?
The package should import. Error "can't find import"  


In the importfile function of lex.c, once a local package is identified, 
by a call to islocalname, the fully qualified file name is assembled and 
findpkg is called. findpkg makes a call to islocalname with the fully 
qualified file name (fqfn) and on windows the call will always fail.       

E.g. say we have: import "./svg" 

The importfile function makes a call to islocalname with "./svg", if the 
call passes the fqfn is assembled and findpkg is called. Contrasting fqfns:

  - OSX: /Users/jpoirier/svgo/svg 
  - Windows: C:\Users/jpoirier/svgo/svg

findpkg calls islocalname passing the fqfn as a parameter. islocalname 
checks the first few characters of the fqfn against "/", "./", or
"../" 
which always fails on windows because of the unique fqfn.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions