Saturday, July 25, 2020

Copy beego codes from one machine to another

As my previous post, just solved the beego installation issue.

Now, I can start "bee" command.

d:\dvp\go\src\bookstore>bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.11.0
2020/07/25 13:01:48 WARN     ▶ 0001 Running application outside of GOPATH
2020/07/25 13:01:48 INFO     ▶ 0002 Using 'bookstore' as 'appname'
2020/07/25 13:01:48 INFO     ▶ 0003 Initializing watcher...
go: cannot find main module; see 'go help modules'
2020/07/25 13:01:48 ERROR    ▶ 0004 Failed to build the application: go: cannot find main module; see 'go help modules'

go: cannot find main module; see 'go help modules'
2020/07/25 13:01:49 ERROR    ▶ 0005 Failed to build the application: go: cannot find main module; see 'go help modules'


In the start up logs, I still suffer the errors.

As another duck solution, I try:

d:\dvp\go\src\bookstore>go mod init bookstore
go: creating new go.mod: module bookstore

Another try :

d:\dvp\go\src\bookstore>bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.11.0
2020/07/25 13:07:07 WARN     ▶ 0001 Running application outside of GOPATH
2020/07/25 13:07:07 INFO     ▶ 0002 Using 'bookstore' as 'appname'
2020/07/25 13:07:07 INFO     ▶ 0003 Initializing watcher...
go: finding module for package github.com/mattn/go-sqlite3
go: finding module for package github.com/astaxie/beego/orm
go: finding module for package github.com/astaxie/beego
go: downloading github.com/mattn/go-sqlite3 v1.14.0
go: downloading github.com/astaxie/beego v1.12.2
go: found github.com/astaxie/beego in github.com/astaxie/beego v1.12.2
go: found github.com/mattn/go-sqlite3 in github.com/mattn/go-sqlite3 v1.14.0
go: downloading github.com/mattn/go-sqlite3 v2.0.3+incompatible
go: downloading github.com/prometheus/client_golang v1.7.0
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: downloading github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/common v0.10.0
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
go: downloading github.com/golang/protobuf v1.4.2
go: downloading github.com/beorn7/perks v1.0.1
go: downloading google.golang.org/protobuf v1.23.0
go: downloading golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading golang.org/x/text v0.3.0
google.golang.org/protobuf/internal/flags
google.golang.org/protobuf/internal/fieldnum
google.golang.org/protobuf/internal/set
github.com/hashicorp/golang-lru
github.com/astaxie/beego/config
github.com/astaxie/beego/utils
gopkg.in/yaml.v2
github.com/astaxie/beego/orm
github.com/shiena/ansicolor
github.com/astaxie/beego/session
github.com/astaxie/beego/logs
github.com/astaxie/beego/grace
github.com/astaxie/beego/context
github.com/astaxie/beego/toolbox
github.com/beorn7/perks/quantile
bookstore/models
github.com/astaxie/beego/context/param
github.com/cespare/xxhash/v2
google.golang.org/protobuf/internal/detrand
google.golang.org/protobuf/internal/pragma
google.golang.org/protobuf/internal/errors
google.golang.org/protobuf/internal/genname
google.golang.org/protobuf/internal/version
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
google.golang.org/protobuf/encoding/protowire
github.com/prometheus/common/model
golang.org/x/sys/internal/unsafeheader
golang.org/x/crypto/acme
google.golang.org/protobuf/reflect/protoreflect
golang.org/x/sys/windows
golang.org/x/text/transform
google.golang.org/protobuf/reflect/protoregistry
google.golang.org/protobuf/internal/strs
google.golang.org/protobuf/internal/mapsort
google.golang.org/protobuf/internal/encoding/messageset
google.golang.org/protobuf/internal/encoding/text
google.golang.org/protobuf/internal/fieldsort
google.golang.org/protobuf/runtime/protoiface
google.golang.org/protobuf/internal/descfmt
google.golang.org/protobuf/internal/descopts
google.golang.org/protobuf/internal/encoding/defval
google.golang.org/protobuf/proto
golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm
golang.org/x/text/secure/bidirule
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/internal/filedesc
github.com/mattn/go-sqlite3
golang.org/x/net/idna
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
google.golang.org/protobuf/internal/encoding/tag
golang.org/x/crypto/acme/autocert
google.golang.org/protobuf/internal/impl
google.golang.org/protobuf/internal/filetype
google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/known/anypb
google.golang.org/protobuf/types/known/durationpb
google.golang.org/protobuf/types/known/timestamppb
github.com/golang/protobuf/proto
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/timestamp
github.com/matttproud/golang_protobuf_extensions/pbutil
github.com/prometheus/client_model/go
github.com/golang/protobuf/ptypes
github.com/prometheus/client_golang/prometheus/internal
github.com/prometheus/common/expfmt
github.com/prometheus/client_golang/prometheus
github.com/prometheus/client_golang/prometheus/promhttp
github.com/astaxie/beego
bookstore/controllers
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
2020/07/25 13:08:08 ERROR    ▶ 0004 Failed to build the application: # github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used

bookstore/controllers
github.com/mattn/go-sqlite3
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
2020/07/25 13:08:09 ERROR    ▶ 0005 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
2020/07/25 13:08:10 ERROR    ▶ 0006 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
2020/07/25 13:08:11 ERROR    ▶ 0007 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
2020/07/25 13:08:12 ERROR    ▶ 0008 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
2020/07/25 13:08:13 ERROR    ▶ 0009 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
2020/07/25 13:08:14 ERROR    ▶ 0010 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

bookstore/controllers
github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%
# bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
2020/07/25 13:08:15 ERROR    ▶ 0011 Failed to build the application: # bookstore/controllers
controllers\book.go:65:2: categoryID declared but not used
controllers\book.go:66:2: publisherID declared but not used
controllers\book.go:67:2: authorID declared but not used
# github.com/mattn/go-sqlite3
exec: "gcc": executable file not found in %PATH%

Still missing gcc. Some of go codes, may include c codes.

Download tdm-gcc and install.



beego installation

At one point, I got the error and could not go on.

d:\dvp\go\src>go get github.com/beego/bee
# github.com/gadelkareem/delve/service/rpccommon
C:\Users\apeng\go\src\github.com\gadelkareem\delve\service\rpccommon\server.go:83:3: cannot use logger (type *"github.com/go-delve/delve/vendor/github.com/sirupsen/logrus".Entry) as type *"github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus".Entry in field value
# github.com/gadelkareem/delve/service/debugger
C:\Users\apeng\go\src\github.com\gadelkareem\delve\service\debugger\debugger.go:129:3: cannot use logger (type *"github.com/go-delve/delve/vendor/github.com/sirupsen/logrus".Entry) as type *"github.com/gadelkareem/delve/vendor/github.com/sirupsen/logrus".Entry in field value


Now, I am looking what is GO111Module.


d:\dvp\go\src>
d:\dvp\go\src>set GO111MODULE=on

d:\dvp\go\src>set GOPROXY=https://goproxy.io

d:\dvp\go\src>go get github.com/beego/bee
go: downloading github.com/beego/bee v1.12.0
go: github.com/beego/bee upgrade => v1.12.0
go: downloading github.com/astaxie/beego v1.12.1
go: downloading gopkg.in/yaml.v2 v2.3.0
go: downloading github.com/lib/pq v1.7.0
go: downloading github.com/gorilla/websocket v1.4.2
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/pelletier/go-toml v1.2.0
go: downloading github.com/gadelkareem/delve v1.4.2-0.20200619175259-dcd01330766f
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading github.com/smartwalle/pongo2render v1.0.1
go: downloading github.com/spf13/viper v1.7.0
go: downloading golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9
go: downloading github.com/spf13/pflag v1.0.3
go: downloading github.com/spf13/afero v1.1.2
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/spf13/cast v1.3.0
go: downloading github.com/spf13/jwalterweatherman v1.0.0
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading gopkg.in/ini.v1 v1.51.0
go: downloading golang.org/x/text v0.3.2
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading github.com/sirupsen/logrus v1.6.0
go: downloading github.com/hashicorp/golang-lru v0.5.4
go: downloading github.com/mattn/go-colorable v0.0.9
go: downloading go.starlark.net v0.0.0-20190702223751-32f345186213
go: downloading github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b
go: downloading github.com/konsorten/go-windows-terminal-sequences v1.0.3
go: downloading golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4
go: downloading github.com/mattn/go-isatty v0.0.3
go: downloading github.com/cosiner/argv v0.1.0