Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Dec 3, 2023
2 parents d2d9d44 + cdad00c commit ce53f23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions private/buf/cmd/buf/buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ func wrapError(err error) error {
switch {
case connectCode == connect.CodeUnauthenticated, isEmptyUnknownError(err):
if authErr, ok := bufconnect.AsAuthError(err); ok && authErr.TokenEnvKey() != "" {
return fmt.Errorf(`Failure: the %[1]s environment variable is set, but is not valid. " +
"Set %[1]s to a valid Buf API key, or unset it. For details, " +
"visit https://docs.buf.build/bsr/authentication`, authErr.TokenEnvKey())
return fmt.Errorf("Failure: the %[1]s environment variable is set, but is not valid. "+
"Set %[1]s to a valid Buf API key, or unset it. For details, "+
"visit https://docs.buf.build/bsr/authentication", authErr.TokenEnvKey())
}
return errors.New("Failure: you are not authenticated. Create a new entry in your netrc, " +
"using a Buf API Key as the password. If you already have an entry in your netrc, check " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"connectrpc.com/connect"
"github.com/bufbuild/buf/private/buf/bufcli"
"github.com/bufbuild/buf/private/bufpkg/bufmodule/bufmoduleref"
"github.com/bufbuild/buf/private/bufpkg/bufmodule"
"github.com/bufbuild/buf/private/bufpkg/bufplugin/bufpluginref"
"github.com/bufbuild/buf/private/gen/proto/connect/buf/alpha/registry/v1alpha1/registryv1alpha1connect"
registryv1alpha1 "github.com/bufbuild/buf/private/gen/proto/go/buf/alpha/registry/v1alpha1"
Expand Down Expand Up @@ -52,7 +52,6 @@ func NewCommand(
func(ctx context.Context, container appflag.Container) error {
return run(ctx, container, flags)
},
bufcli.NewErrorInterceptor(),
),
BindFlags: flags.Bind,
}
Expand Down Expand Up @@ -84,28 +83,28 @@ func run(
if err != nil {
return err
}
moduleReference, err := bufmoduleref.ModuleReferenceForString(flags.Module)
moduleRef, err := bufmodule.ParseModuleRef(flags.Module)
if err != nil {
return appcmd.NewInvalidArgumentErrorf("failed parsing module reference: %s", err.Error())
}
pluginIdentity, pluginVersion, err := bufpluginref.ParsePluginIdentityOptionalVersion(flags.Plugin)
if err != nil {
return appcmd.NewInvalidArgumentErrorf("failed parsing plugin reference: %s", err.Error())
}
if pluginIdentity.Remote() != moduleReference.Remote() {
if pluginIdentity.Remote() != moduleRef.ModuleFullName().Registry() {
return appcmd.NewInvalidArgumentError("module and plugin must be from the same remote")
}
resolver := connectclient.Make(
clientConfig,
moduleReference.Remote(),
moduleRef.ModuleFullName().Registry(),
registryv1alpha1connect.NewResolveServiceClient,
)
packageVersion, err := resolver.GetPythonVersion(ctx, connect.NewRequest(
&registryv1alpha1.GetPythonVersionRequest{
ModuleReference: &registryv1alpha1.LocalModuleReference{
Owner: moduleReference.Owner(),
Repository: moduleReference.Repository(),
Reference: moduleReference.Reference(),
Owner: moduleRef.ModuleFullName().Owner(),
Repository: moduleRef.ModuleFullName().Name(),
Reference: moduleRef.Ref(),
},
PluginReference: &registryv1alpha1.GetRemotePackageVersionPlugin{
Owner: pluginIdentity.Owner(),
Expand Down

0 comments on commit ce53f23

Please sign in to comment.