opensearch-project / opensearch-cli

A full-featured command line interface (CLI) for OpenSearch.
https://opensearch.org/docs/latest/clients/cli/
Apache License 2.0
44 stars 24 forks source link

[BUG] Module name prevents vendoring this as a tool #61

Open ojkelly opened 2 years ago

ojkelly commented 2 years ago

What is the bug? The project cannot be vendored as a tool. More info on the concept https://marcofranssen.nl/manage-go-tools-via-go-modules

How can one reproduce the bug?

  1. either go install github.com/opensearch-project/opensearch-cli@main
go install github.com/opensearch-project/opensearch-cli@main                                        
go: github.com/opensearch-project/opensearch-cli@main: github.com/opensearch-project/opensearch-cli@v1.1.1-0.20220614170259-6cc9916c0aac: parsing go.mod:
        module declares its path as: opensearch-cli
                but was required as: github.com/opensearch-project/opensearch-cli
  1. or running go mod tidy && go mod vendor with a tools.go file as follows
# tools.go

//go:build tools
// +build tools

// This package is used to enable vendoring of tooling used in the repo, that is
// run via cli, and not imported anywhere.
package tools

import (
    _ "github.com/opensearch-project/opensearch-cli"
)

What is the expected behavior?

The project to be vendored in the repo.

What is your host/environment?

wbeckler commented 1 year ago

Seems like a worthwhile fix. Feel free to contribute a PR.