Tag Archives: golang

Golang reported an error in importing its own package

Reason: after using the GIT clone project, the project root path is a lowercase English name, such as cmdbapi, but when the import in the project imports its own related packages, an error is reported in red

 

 

Solution: rewrite the project name to the name of the import package, namely cmdbapi. Of course, you can also rewrite the import package to lowercase

Error report of gomq installation macro: AC_ LIBTOOL_ WIN32_ DLL

Detailed map traversal, teach you to master the complex gremlin query debugging method>>>

[root@VM_171_105_centos zeromq4-1-4.1.6]# ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --include=config --force
configure.ac:62: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:63: error: possibly undefined macro: AC_PROG_LIBTOOL
configure:4954: error: possibly undefined macro: AC_DISABLE_STATIC
configure:4958: error: possibly undefined macro: AC_ENABLE_STATIC
autoreconf: /usr/bin/autoconf failed with exit status: 1
autogen.sh: error: autoreconf exited with status 0
[root@VM_171_105_centos zeromq4-1-4.1.6]# 

You need to install Yum install – y libtool

It can be solved after installation


Type switch in golang

In the golang language, there is also a way of using javascript.

like

func (a interface{}){

//1st element

if inst,ok:=a.(TypeA); ok{

inst.MethodA()

}

//Second item

switch inst:=a.(type){

case TypeA:

inst.MethodA()

default:

fmt.Println(“unknow”)

}

}

may be any type

a.(some kind of man) returns two or more values inst and ok, meaning whether or not this type of man, or if inst is the type of man

a.(type) type is a comma-separated string using

TypeA(a) is forced to translate