Hello everybody,
Can anybody assist me with this challenge? Any assistance is APPRECIATED!
I’m attempting to entry the consul API totally with this bundle:
“github [slash] github[dot]com/hashicorp/consul/api”
I put in it on my Home windows machine and imported it into my Go script, nevertheless it appears to have a dependency with this bundle:
“src[slash] github[dot]com/armon/go-metrics”
Every time I run the script (which truly ought to have labored) or run this command “go get -u [github]github[dot]com/armon/go-metrics” to replace the model of the bundle I get this message:
# “src[slash] github[dot]com/armon/go-metrics”
“src[slash] gosrcgithub[dot]comarmongo-metricsstart.go:37:17: can not use generic sort iradix.Tree[T any] with out instantiation”
“src[slash] gosrcgithub[dot]comarmongo-metricsmetrics.go:166:23: can not infer T (“src[slash]gosrcgithub[dot]comhashicorpgo-immutable-radixiradix.go:32:10”)”
These are my imports:
import (
"encoding/json"
"fmt"
"github[dot]com/go-git/go-git"
"github[dot]com/go-git/go-git/plumbing/transport/http"
"github[dot]com/hashicorp/consul/api"
"github[dot]com/hashicorp/hcl/hclsimple"
)
That is the operate the place I create an API consumer (It’s not accomplished but!)
func createACLToken(file_name string) {
// Create a brand new api.Shopper object to connect with the Consul server
consumer, err := api.NewClient(api.DefaultConfig())
if err != nil {
log.Deadly(err)
}
// Learn the ACL token configuration from the .hcl file
var token_config api.ACLToken
err = hclsimple.DecodeFile(fmt.Sprintf("%s.hcl", file_name), nil, &token_config)
if err != nil {
log.Deadly(err)
}
acl := consumer.ACL()
/// Create a brand new coverage with the identical title because the ACL token
coverage := api.ACLPolicy{Identify: file_name, Guidelines: token_config.Guidelines}
createdPolicy, writeMeta, err := acl.PolicyCreate(&coverage, nil)
if err != nil {
log.Deadly(err)
}
fmt.Printf("Coverage created: %vnWriteMeta: %vn", createdPolicy, writeMeta)
// // Create a brand new position with the identical title because the ACL token
// position := api.ACLRole{Identify: file_name, Insurance policies: []string{file_name}}
// _, err = acl.RoleCreate(&position, nil)
// if err != nil {
// log.Deadly(err)
// }
}
I additionally checked these packages in GOPATH listing and they’re out there:
“…gosrcgithub[dot]comarmongo-metrics”
“…gosrcgithub[dot]comarmongo-radix”
“…gosrcgithub[dot]comhashicorpconsulapi”
“…gosrcgithub[dot]comhashicorphclhclsimple”