In my source tree, a 'configs' folder containing all possible config
files, like this:
     - configs
       \ test.json
       \ production.json
     - main.go

     Pseudo code of load config when unit test:
- get the absolute path of the folder containing main.go
   * this can be achieved by utilize runtime.Caller(1)
- join this path when 'configs', and 'test.json'

     It works when the binary is built by the 'main.go' I was editing.
     When unit test, it seems that all source code would be copied to a
temporary folder to build the binary for testing.
     This means the result of runtime.Caller(1) would not be the same as my

     Is there any way to make 'go test' to build binary without making a
copy of source code?

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
postedJan 21, '15 at 12:12p
activeJan 21, '15 at 12:12p

1 user in discussion

Mission liao: 1 post



site design / logo © 2022 Grokbase