Original post

Hello everyone,

I am trying to create a Python extension written in using gopy. For this I copied an example from the gopy github https://github.com/go-python/gopy/blob/master/_examples/simple/simple.go):

// Copyright 2015 The go-python Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// simple is a simple package.
package simple

// Func is a simple func
func Func() {}

// Add is a (less) simple func
func Add(i, j int) int {
        return i + j
}

func Bool(b bool) bool {
        return b
}

func Comp64Add(i, j complex64) complex64 {
        return i + j
}

func Comp128Add(i, j complex128) complex128 {
        return i + j
}

Now I initialize a Go module using

go mod init test.com/simple

After that I run

gopy gen test.com/simple

This creates a few files such as build.py, go.py, and a Makefile. Now when I run the Makefile via

make gen

I get the following error:

can't load package: import cycle not allowed
package test.com/simple
    imports test.com/simple
2020/02/20 20:57:16 error installing [test.com/simple]: exit status 1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6930bf]

Does somebody know where I went wrong?