#30 Don't skip testdata
Merged 2 years ago by eclipseo. Opened 2 years ago by krouma.
Unknown source testdata  into  master

file modified
+2 -1
@@ -173,7 +173,8 @@

  		// Cited from https://golang.org/cmd/go/#hdr-Package_lists:

  		//   Directory and file names that begin with "." or "_" are ignored

  		//   by the go tool, as are directories named "testdata".

- 		if base := filepath.Base(relPath); base[0] == '.' || base[0] == '_' || base == "testdata" || base == "vendor" {

+ 		// However, testdata can be used by other -devel packages

+ 		if base := filepath.Base(relPath); base[0] == '.' || base[0] == '_' || base == "vendor" {

  			return filepath.SkipDir

  		}

  

Testdata can be used by other packages, e.g. github.com/go-git/go-git uses testdata of golang.org/x/crypto/ssh, but they are not provided by golang-x-crypto-devel, so building go-git (generated by go2rpm) fails because of failed dependency.
Also testdata are generally useful while developing and resulting binaries will not contain them anyway.

Hmmm, in general I add them manually but ok.

Pull-Request has been merged by eclipseo

2 years ago

Sorry, I've had to revert this change. After applying it, it causes several bugs:

  1. testdata that includes invalid Go code can cause golist to panic, as it does so when importing a directory fails.
  2. Imports in testdata now get added as dependencies, which can break %go_generate_buildrequires, if these are non-existent.
  3. %gocheck attempts to run tests on testdata code, but that's not how Go does it. These files may be invalid as well, causing %check to fail.
Metadata