Bug with case insensitive imports

1,648 views
Skip to first unread message

dane

unread,
Sep 15, 2012, 7:58:37 AM9/15/12
to golan...@googlegroups.com
Hello everybody,

So I have two files in my package which both import the go-sdl package.

file1:
file2:

This got me some duplicate definition errors. Maybe someone who knows how to do it could file an issue report :)

Best Regards

David

Jan Mercl

unread,
Sep 15, 2012, 8:20:48 AM9/15/12
to dane, golan...@googlegroups.com
On Sat, Sep 15, 2012 at 1:58 PM, dane <david.n...@googlemail.com> wrote:
> This got me some duplicate definition errors. Maybe someone who knows how to
> do it could file an issue report :)

Wrt the specs, I think this bug is in the user's source code, not in
the compiler.

-j

Yaşar Arabacı

unread,
Sep 15, 2012, 8:21:32 AM9/15/12
to dane, golan...@googlegroups.com
Shouldn't at least one of them give something like "unresolved import
error"? If you have actually two seperate libraries with same name you
can import them like;

import ttemplate "text/template"
import htemplate "html/temlpate"

and you can use ttemplate for "text/template" and htemplate for
"html/template" without name collision.

2012/9/15 dane <david.n...@googlemail.com>:
> --
>
>



--
http://yasararabaci.tumblr.com

dane

unread,
Sep 15, 2012, 8:52:32 AM9/15/12
to golan...@googlegroups.com, dane
Maybe I did not make the issue clear.

In both files i want to import the same package. And individually it does work, because the import paths are case insensitive.
However if i write the import paths differently I get errors.

This works:
file1:
file2:

So does this

But this does not work
BR

David

Aram Hăvărneanu

unread,
Sep 15, 2012, 8:55:09 AM9/15/12
to dane, golan...@googlegroups.com
Import paths are not case insensitive, your file system might be. Use
the correct casing all the time.

--
Aram Hăvărneanu

dane

unread,
Sep 15, 2012, 11:49:42 AM9/15/12
to golan...@googlegroups.com, dane
Well, that would explain the behavior, since I am using MacOsX.

Dave Cheney

unread,
Sep 15, 2012, 10:44:48 PM9/15/12
to dane, golan...@googlegroups.com
Welcome to HFS+ (a case insensitive, case preserving filesystem). My
strong recommendation would be to avoid (and avoid packages that have)
import paths that contain upper case letters.
> --
>
>

Andrew Gerrand

unread,
Sep 16, 2012, 2:22:22 AM9/16/12
to dane, golan...@googlegroups.com
On 15 September 2012 21:58, dane <david.n...@googlemail.com> wrote:
> So I have two files in my package which both import the go-sdl package.
>
> file1:
> import "github.com/banthar/Go-SDL/sdl"
> file2:
> import "github.com/banthar/Go-Sdl/sdl"

Just use whichever path works with "go get". (Ie, the first one.)

Andrew

je...@scottsmarketplace.com

unread,
Feb 22, 2016, 5:15:29 PM2/22/16
to golang-nuts
your upper/lower case is different in each. Go-SDL and Go-Sdl.  Make them the same.
Reply all
Reply to author
Forward
0 new messages