Skip to content

Instantly share code, notes, and snippets.

@jamesharr
Created January 4, 2014 19:44
Show Gist options
  • Save jamesharr/8259755 to your computer and use it in GitHub Desktop.
Save jamesharr/8259755 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"play/pkgaccess/pkg"
)
func main() {
fmt.Println(pkg.Bar) // Huh, I an access it
lcl := pkg.Bar // Huuuh, I can create a copy of it.
fmt.Println(lcl)
var lcl2 pkg.foo // But I can't declare one. Compile error: cannot refer to unexported name "pkg.foo"
fmt.Println(lcl2)
}
/*
// File: play/pkgaccess/pkg/asdf.go
package pkg
type foo struct {
Foo int
}
var Bar = foo{1}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment