fix(Compile): Fixed error "<module> is not in GOROOT"
This commit is contained in:
parent
cbbe886dbb
commit
39a136dc50
4 changed files with 35 additions and 30 deletions
|
|
@ -3,8 +3,8 @@ package Commands
|
||||||
import (
|
import (
|
||||||
"github.com/olekukonko/tablewriter"
|
"github.com/olekukonko/tablewriter"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
proto "lotus-pm.net/proto"
|
||||||
"lpm-cli/Lotus"
|
"lpm-cli/Lotus"
|
||||||
proto "lpm-cli/Proto/lpm/go"
|
|
||||||
"lpm-cli/ProtoHandler"
|
"lpm-cli/ProtoHandler"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,33 @@
|
||||||
package ProtoHandler
|
package ProtoHandler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
proto "lotus-pm.net/proto"
|
||||||
"lpm-cli/Lotus"
|
"lpm-cli/Lotus"
|
||||||
proto "lpm-cli/Proto/lpm/go"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Package struct{
|
type Package struct {
|
||||||
PackageMetadata PackageMetadata
|
PackageMetadata PackageMetadata
|
||||||
Register Lotus.Registry
|
Register Lotus.Registry
|
||||||
}
|
}
|
||||||
|
|
||||||
type PackageMetadata struct {
|
type PackageMetadata struct {
|
||||||
Publisher string
|
Publisher string
|
||||||
Name string
|
Name string
|
||||||
Version string
|
Version string
|
||||||
Description string
|
Description string
|
||||||
Tags []string
|
Tags []string
|
||||||
Labels map[string]string
|
Labels map[string]string
|
||||||
PackageSize uint64
|
PackageSize uint64
|
||||||
Checksums Checksums
|
Checksums Checksums
|
||||||
Platform string
|
Platform string
|
||||||
Architecture string
|
Architecture string
|
||||||
Dependencies []Dependency
|
Dependencies []Dependency
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func fillDependencies(protoDependency []*proto.Dependency) []Dependency {
|
func fillDependencies(protoDependency []*proto.Dependency) []Dependency {
|
||||||
dependencies := make([]Dependency, len(protoDependency))
|
dependencies := make([]Dependency, len(protoDependency))
|
||||||
|
|
||||||
for i, dep := range protoDependency{
|
for i, dep := range protoDependency {
|
||||||
dependencies[i].ID = dep.GetId()
|
dependencies[i].ID = dep.GetId()
|
||||||
dependencies[i].VersionFilter = dep.GetVersionFilter()
|
dependencies[i].VersionFilter = dep.GetVersionFilter()
|
||||||
}
|
}
|
||||||
|
|
@ -39,12 +38,16 @@ func fillDependencies(protoDependency []*proto.Dependency) []Dependency {
|
||||||
func fillChecksums(checksum []*proto.Checksum) Checksums {
|
func fillChecksums(checksum []*proto.Checksum) Checksums {
|
||||||
checksums := Checksums{}
|
checksums := Checksums{}
|
||||||
|
|
||||||
for i, chk := range checksum{
|
for i, chk := range checksum {
|
||||||
switch checksum[i].Algorithm{
|
switch checksum[i].Algorithm {
|
||||||
case 0: checksums.MD5 = chk.Checksum
|
case 0:
|
||||||
case 1: checksums.SHA1 = chk.Checksum
|
checksums.MD5 = chk.Checksum
|
||||||
case 2: checksums.SHA256 = chk.Checksum
|
case 1:
|
||||||
case 3: checksums.SHA512 = chk.Checksum
|
checksums.SHA1 = chk.Checksum
|
||||||
|
case 2:
|
||||||
|
checksums.SHA256 = chk.Checksum
|
||||||
|
case 3:
|
||||||
|
checksums.SHA512 = chk.Checksum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,4 +66,4 @@ func (pkgMeta *PackageMetadata) FillMetadata(protoData *proto.PackageMetadata) {
|
||||||
pkgMeta.Platform = protoData.Platform
|
pkgMeta.Platform = protoData.Platform
|
||||||
pkgMeta.Architecture = protoData.Architecture
|
pkgMeta.Architecture = protoData.Architecture
|
||||||
pkgMeta.Dependencies = fillDependencies(protoData.GetDependencies())
|
pkgMeta.Dependencies = fillDependencies(protoData.GetDependencies())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package ProtoHandler
|
||||||
import (
|
import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
proto "lotus-pm.net/proto"
|
||||||
"lpm-cli/Lotus"
|
"lpm-cli/Lotus"
|
||||||
proto "lpm-cli/Proto/lpm/go"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -22,25 +22,24 @@ func (protoWrap ProtoWrapper) CreateConnection(address string) *grpc.ClientConn
|
||||||
|
|
||||||
func (protoWrap ProtoWrapper) CreateRegistryClient(conn *grpc.ClientConn) (proto.LpmRegistryClient, context.Context, context.CancelFunc) {
|
func (protoWrap ProtoWrapper) CreateRegistryClient(conn *grpc.ClientConn) (proto.LpmRegistryClient, context.Context, context.CancelFunc) {
|
||||||
lrc := proto.NewLpmRegistryClient(conn)
|
lrc := proto.NewLpmRegistryClient(conn)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second * 10)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
|
|
||||||
return lrc, ctx, cancel
|
return lrc, ctx, cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (protoWrap ProtoWrapper) ParsePackages(res *proto.SearchResponse, reg Lotus.Registry) []Package {
|
func (protoWrap ProtoWrapper) ParsePackages(res *proto.SearchResponse, reg Lotus.Registry) []Package {
|
||||||
var packages []Package
|
var packages []Package
|
||||||
for _, pkg := range res.GetPackages() {
|
for _, pkg := range res.GetPackages() {
|
||||||
var tmpMeta PackageMetadata
|
var tmpMeta PackageMetadata
|
||||||
tmpMeta.FillMetadata(pkg)
|
tmpMeta.FillMetadata(pkg)
|
||||||
packages = append(packages, Package {
|
packages = append(packages, Package{
|
||||||
PackageMetadata: tmpMeta,
|
PackageMetadata: tmpMeta,
|
||||||
Register: Lotus.Registry{
|
Register: Lotus.Registry{
|
||||||
Register: reg.Register,
|
Register: reg.Register,
|
||||||
Address: reg.Address,
|
Address: reg.Address,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return packages
|
return packages
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
go.mod
7
go.mod
|
|
@ -2,22 +2,25 @@ module lpm-cli
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
replace lotus-pm.net/proto => ./proto/lpm/go
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.5.2
|
|
||||||
github.com/olekukonko/tablewriter v0.0.5
|
github.com/olekukonko/tablewriter v0.0.5
|
||||||
github.com/sirupsen/logrus v1.8.1
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/urfave/cli/v2 v2.3.0
|
github.com/urfave/cli/v2 v2.3.0
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202
|
golang.org/x/net v0.0.0-20200822124328-c89045814202
|
||||||
google.golang.org/grpc v1.42.0
|
google.golang.org/grpc v1.42.0
|
||||||
google.golang.org/protobuf v1.27.1
|
lotus-pm.net/proto v0.0.0-00010101000000-000000000000
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
|
||||||
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
github.com/russross/blackfriday/v2 v2.0.1 // indirect
|
||||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
|
||||||
golang.org/x/text v0.3.0 // indirect
|
golang.org/x/text v0.3.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
||||||
|
google.golang.org/protobuf v1.27.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Reference in a new issue