Skip to content

Commit

Permalink
rpk: topic describe --regex supports internal topics
Browse files Browse the repository at this point in the history
Cherry-picked from 3f1a52e
  • Loading branch information
r-vasquez committed Sep 26, 2024
1 parent eb5c237 commit dc0e296
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
49 changes: 26 additions & 23 deletions src/go/rpk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,63 +25,66 @@ CONT_PKG='github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/container/common'

LDFLAGS=-X $(VER_PKG).version=$(VER) -X $(VER_PKG).rev=$(REV) -X $(CONT_PKG).tag=$(IMG_TAG) -X ${VER_PKG}.hostOs=${GOOS} -X ${VER_PKG}.hostArch=${GOARCH} -X ${VER_PKG}.buildTime=${BUILD_TIME}

.PHONY: ready
ready: build test fmt lint bazel check_diff
all: help

.PHONY: build
build:
ready: build test fmt lint bazel check_diff ## Runs all. Ensures commit is ready.

build: ## Build rpk.
$(shell mkdir -p $(OUTDIR))
$(GOCMD) build -ldflags '$(LDFLAGS)' -o $(OUTDIR) ./...

.PHONY: test
test:
test: ## Run rpk unit tests.
$(GOCMD) test ./... -count=1

.PHONY: tidy
tidy:
tidy: ## Run go mod tidy.
$(GOCMD) mod tidy

.PHONY: lint
lint: install_golangci_lint run_linter
lint: install_golangci_lint run_linter ## Run golangci-lint linter.

.PHONY: fmt
fmt: install_gofumpt run_gofumpt
fmt: install_gofumpt run_gofumpt ## Run Gofumpt formatter.

.PHONY: bazel
bazel: install_bazelisk bazel_generate_build bazel_tidy
bazel: install_bazelisk bazel_generate_build bazel_tidy ## Autogenerates BUILD files and resolve bazel dependencies.

.PHONY: install_gofumpt
install_gofumpt:
@echo "installing gofumpt..."
@$(GOCMD) install mvdan.cc/gofumpt@latest

.PHONY: run_gofumpt
run_gofumpt:
@echo "running gofumpt"
$(shell find -type f -name '*.go' | xargs -n1 $(GOFUMPTCMD) -w)

.PHONY: install_golangcilint
install_golangci_lint:
@echo "installing golangci-lint"
@$(GOCMD) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

.PHONY: run_linter
run_linter:
$(GOLANGCILINTCMD) run

.PHONY: install_bazelisk
install_bazelisk:
@echo "installing bazelisk"
@$(GOCMD) install github.com/bazelbuild/bazelisk@latest

.PHONY: bazel_generate_build
bazel_generate_build: install_bazelisk
@$(BAZELCMD) run //:gazelle

.PHONY: bazel_tidy
bazel_tidy: install_bazelisk
@$(BAZELCMD) mod tidy

.PHONY: check_diff
check_diff:
$(shell git diff --exit-code)
git diff --exit-code

GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
CYAN := $(shell tput -Txterm setaf 6)
RESET := $(shell tput -Txterm sgr0)

help: ## Show this help.
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} { \
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
}' $(MAKEFILE_LIST)
2 changes: 1 addition & 1 deletion src/go/rpk/pkg/cli/topic/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func parseKVs(in []string) (map[string]string, error) {

func regexTopics(adm *kadm.Client, expressions []string) ([]string, error) {
// Now we list all topics to match against our expressions.
topics, err := adm.ListTopics(context.Background())
topics, err := adm.ListTopicsWithInternal(context.Background())
if err != nil {
return nil, fmt.Errorf("unable to list topics: %w", err)
}
Expand Down

0 comments on commit dc0e296

Please sign in to comment.