How to access global variables
I would “inject” the starttime variable instead, otherwise you have a circular dependency between the packages. main.go var StartTime = time.Now() func main() { otherPackage.StartTime = StartTime } otherpackage.go var StartTime time.Time