Skip to content

Commit 2d30b71

Browse files
committed
all: remove GODEBUG=cgocheck=0 scaffolding
1 parent 9240dfc commit 2d30b71

File tree

5 files changed

+1
-97
lines changed

5 files changed

+1
-97
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ sudo: required
1515
before_install:
1616
- sudo apt-get install libffi-dev python-cffi
1717
- export PATH=$HOME/gopath/bin:$PATH
18-
# temporary workaround for go-python/gopy#83
19-
- export GODEBUG=cgocheck=0
2018

2119
notifications:
2220
email:

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ gopy
66

77
`gopy` generates (and compiles) a `CPython` extension module from a `go` package.
88

9-
**WARNING** `gopy` is currently not compatible with `Go>=1.6` and its improved `CGo` rules as documented in [cmd/cgo](https://golang.org/cmd/cgo/#hdr-Passing_pointers).
10-
To be able to run a `CPython` module generated with `Go>=1.6`, one needs to export `GODEBUG=cgocheck=0` to disable the `CGo` rules runtime checker. (see [issue 83](https://github.com/go-python/gopy/issues/83) for more informations.)
11-
129
## Installation
1310

1411
```sh

bind/gengo.go

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,10 @@ import (
88
"fmt"
99
"go/token"
1010
"go/types"
11-
"runtime"
1211
"strings"
1312
)
1413

1514
const (
16-
checkGoVersionImport = `"strconv"
17-
"strings"
18-
"os"
19-
`
20-
checkGoVersion = "_cgopy_CheckGoVersion()"
21-
checkGoVersionDef = `
22-
func _cgopy_CheckGoVersion() {
23-
godebug := os.Getenv("GODEBUG")
24-
cgocheck := -1
25-
var err error
26-
27-
if godebug != "" {
28-
const prefix = "cgocheck="
29-
for _, option := range strings.Split(godebug, ",") {
30-
if !strings.HasPrefix(option, prefix) {
31-
continue
32-
}
33-
cgocheck, err = strconv.Atoi(option[len(prefix):])
34-
if err != nil {
35-
cgocheck = -1
36-
fmt.Fprintf(os.Stderr, "gopy: invalid cgocheck value %q (expected an integer)\n", option)
37-
}
38-
}
39-
}
40-
41-
if cgocheck != 0 {
42-
fmt.Fprintf(os.Stderr, "gopy: GODEBUG=cgocheck=0 should be set for Go>=1.6\n")
43-
}
44-
}
45-
`
4615
goPreamble = `// Package main is an autogenerated binder stub for package %[1]s.
4716
// gopy gen -lang=go %[1]s
4817
//
@@ -1137,13 +1106,7 @@ func (g *goGen) genPreamble() {
11371106
panic(err)
11381107
}
11391108

1140-
version := runtime.Version()
1141-
major, minor, _ := getGoVersion(version)
1142-
if major >= 1 && minor >= 6 {
1143-
g.Printf(goPreamble, n, pkgcfg, pkgimport, checkGoVersionImport, checkGoVersionDef, checkGoVersion)
1144-
} else {
1145-
g.Printf(goPreamble, n, pkgcfg, pkgimport, "", "", "")
1146-
}
1109+
g.Printf(goPreamble, n, pkgcfg, pkgimport, "", "", "")
11471110
}
11481111

11491112
func (g *goGen) tupleString(tuple []*Var) string {

bind/utils.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
"os/exec"
1414
"regexp"
1515
"sort"
16-
"strconv"
17-
"strings"
1816
)
1917

2018
func isErrorType(typ types.Type) bool {
@@ -146,15 +144,3 @@ func getPkgConfig(vers int) (string, error) {
146144

147145
return pkgcfg, nil
148146
}
149-
150-
func getGoVersion(version string) (int64, int64, error) {
151-
version_regex := regexp.MustCompile(`^go((\d+)(\.(\d+))*)`)
152-
match := version_regex.FindStringSubmatch(version)
153-
if match == nil {
154-
return -1, -1, fmt.Errorf("gopy: invalid Go version information: %q", version)
155-
}
156-
version_info := strings.Split(match[1], ".")
157-
major, _ := strconv.ParseInt(version_info[0], 10, 0)
158-
minor, _ := strconv.ParseInt(version_info[1], 10, 0)
159-
return major, minor, nil
160-
}

bind/utils_test.go

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)