#how to access data from main package

5 messages · Page 1 of 1 (latest)

sharp trail
#

i have project with main package that has bunch of const and types and inside this project i have folder that needs this types but i can't seem to get acces to it

project/
main
 | main.go 
 | types.go
 | const.go 
   tui/
    tui 
    | tui.go <- can't get types from main to be accesible in tui.go 
craggy pumice
#

your main package can never be imported

#

normally it's done like this
/cmd/thing/main.go (entrypoint)
/consnts.go
/(...).go
/tui/tui.go (can import const and whatever on root)

#

note that your root should not import tui, and your root cannot import main

#

(nothing can import main)