you are calling in main file like: fmt.Println(helloworld()) in test file also you are calling like helloworld() it will fail. as helloworld function is not exported. Test file will unable to call because it is not exported. in both file, call as Helloworld().