Skip to content

Instantly share code, notes, and snippets.

@steevehook
Created October 22, 2019 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steevehook/11d919c4b7f15c3e21204737576f8f76 to your computer and use it in GitHub Desktop.
Save steevehook/11d919c4b7f15c3e21204737576f8f76 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/gophertuts/go-basics/constants/scope/p1"
)
const (
Exported = 10
unExported = "Hello"
)
func main() {
const (
private = 10
Private = "Hello"
)
fmt.Println("main: p1: Exported: ", p1.Exported)
fmt.Println("main: Exported: ", Exported)
fmt.Println("main: unExported: ", unExported)
fmt.Println("main: Private: ", Private)
fmt.Println("main: private: ", private)
}
package p1
import (
"fmt"
"github.com/gophertuts/go-basics/constants/scope/p2"
)
const (
Exported = "exported"
unExported = 10
)
func init() {
fmt.Println("p1: unExported:", unExported)
fmt.Println("p1: p2: Exported:", p2.Exported)
}
package p2
const Exported = 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment