New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import cycle not allowed #40721
Comments
"cmd/minikube/cmd/main.go" that file content package main
import (
"bytes"
"fmt"
"log"
"os"
"regexp"
"strconv"
// initflag must be imported before any other minikube pkg.
// Fix for https://github.com/kubernetes/minikube/issues/4866
_ "k8s.io/minikube/pkg/initflag"
// Register drivers
_ "k8s.io/minikube/pkg/minikube/registry/drvs"
mlog "github.com/docker/machine/libmachine/log"
"github.com/golang/glog"
"github.com/google/slowjam/pkg/stacklog"
"github.com/pkg/profile"
"k8s.io/minikube/cmd/minikube/cmd"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/machine"
"k8s.io/minikube/pkg/minikube/out"
_ "k8s.io/minikube/pkg/provision"
) "hack/help_text/gen_help_text.go" that file content package main
import (
"fmt"
"os"
"github.com/spf13/cobra/doc"
"k8s.io/minikube/cmd/minikube/cmd"
) |
I cant build minikube due to other reasons.
how was the code in
Please link to the build guide used or better list the exact commands executed to get to the error. There seems to be a corresponding issue open on the minikube issue tracker: kubernetes/minikube#8964 |
cmd/go is identifying the loop:
It's not related to the Looking at https://github.com/kubernetes/minikube/tree/master/pkg/minikube/translate, I don't see any import of "k8s.io/minikube/pkg/minikube/assets". Did you add that dependency loop while trying to fix the undefined |
@martisch ,About "undefined: Asset" issue,Please view reference that url kubernetes/minikube#2656, 1.install go-bindata soft go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/... 3.Import Asset packet, change code on translate.go import (
"encoding/json"
"fmt"
"github.com/cloudfoundry-attic/jibber_jabber"
"github.com/golang/glog"
"golang.org/x/text/language"
"k8s.io/minikube/pkg/minikube/assets"
"path"
"strings"
)
Asset.(translationFile) ->assets.Asset(translationFile) |
@mdempsky I have import of "k8s.io/minikube/pkg/minikube/assets" in "master/pkg/minikube/translate", fix the undefined Asset erro |
@oyb001 the root cause is assets depends on the template package. Adding assets as a dependency of template creates a loop. |
@oyb001 Thanks, then it sounds like cmd/go is working as intended. Dependency cycles like that are not allowed in Go. This is either a minikube issue or an issue with your undefined Asset fix. |
/Users/ouyangbin/Documents/001_work/01_git/minikube/pkg/minikube/assets/assets.go package assets
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"reflect"
"strings"
"unsafe"
)
func bindata_read(data, name string) ([]byte, error) {
var empty [0]byte
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data
bx.Len = len(data)
bx.Cap = bx.Len |
"k8s.io/minikube/pkg/minikube/assets" imports "k8s.io/minikube/pkg/minikube/config" here: |
Environment:
Minikube version (use minikube version): master@50a8c9824a7610c954043e041ddb6c078d9d756d
OS : MacOS Mojave 10.14.6 (18G103)
Go Env
What you expected to happen: make to succeed
How to reproduce it (as minimally and precisely as possible): Follow the build guide, and when attempting make it will fail with the above error.
I have search all code by IDE, I believe have not doing any cyclic import, and the error you're getting is a compiler bug,
the follow two file have import "k8s.io/minikube/cmd/minikube/cmd", but that two file package is main
The text was updated successfully, but these errors were encountered: