fix(Compile): Fixed error "<module> is not in GOROOT"

This commit is contained in:
netbenix 2022-08-27 19:08:57 +02:00
parent cbbe886dbb
commit 39a136dc50
4 changed files with 35 additions and 30 deletions

View file

@ -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"
) )

View file

@ -1,11 +1,11 @@
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
} }
@ -24,11 +24,10 @@ type PackageMetadata struct {
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
} }
} }

View file

@ -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,18 +22,17 @@ 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,

7
go.mod
View file

@ -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
) )