diff options
| -rw-r--r-- | Makefile | 8 | ||||
| -rw-r--r-- | cli.go | 4 | ||||
| -rw-r--r-- | cli_test.go | 9 | ||||
| -rw-r--r-- | cmd/gotp/main.go | 4 | ||||
| -rw-r--r-- | gotp.go | 8 |
5 files changed, 22 insertions, 11 deletions
@@ -3,12 +3,18 @@ .PHONY: all test build install serve-doc -all: test build +all: test lint build test: CGO_ENABLED=1 go test -race -failfast -coverprofile=cover.out ./... go tool cover -html=cover.out -o cover.html +.PHONY: lint +lint: + -revive ./... + -fieldalignment ./... + -shadow ./... + build: mkdir -p _sys/usr/bin/ go build -o _sys/usr/bin/ ./cmd/... @@ -19,13 +19,17 @@ import ( "golang.org/x/term" ) +// Readme embed the README.md, rendered in "gotp help". +// //go:embed README.md var Readme string +// Cli define the command line interface for gotp program. type Cli struct { cfg *config } +// NewCli create and initialize new CLI for gotp program. func NewCli() (cli *Cli, err error) { var ( logp = `NewCli` diff --git a/cli_test.go b/cli_test.go index 5eeffd4..8d0218c 100644 --- a/cli_test.go +++ b/cli_test.go @@ -198,10 +198,11 @@ func TestCli_SetPrivateKey(t *testing.T) { } var ( - gotLabels []string = cli.List() - label string - issuer *Issuer - got bytes.Buffer + gotLabels = cli.List() + + label string + issuer *Issuer + got bytes.Buffer ) for _, label = range gotLabels { diff --git a/cmd/gotp/main.go b/cmd/gotp/main.go index 71e5226..c0fbece 100644 --- a/cmd/gotp/main.go +++ b/cmd/gotp/main.go @@ -149,8 +149,8 @@ func doAdd(cli *gotp.Cli, args []string) { func doGenerate(cli *gotp.Cli, args []string) { var ( - label = args[1] - n int = 1 + label = args[1] + n = 1 listOtp []string otp string @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2021 M. Shulhan <ms@kilabit.info> // SPDX-License-Identifier: GPL-3.0-or-later +// Package gotp core library for building gotp CLI. package gotp import ( @@ -24,15 +25,14 @@ const ( providerNameAegis = `aegis` ) -var ( - Version = `0.3.1` -) +// Version define the latest version of this module and gotp CLI. +var Version = `0.3.1` // normalizeLabel convert non alpha number, hyphen, underscore, or period // characters into `-`. func normalizeLabel(in string) (out string) { var ( - replacement rune = '-' + replacement = '-' buf strings.Builder r rune |
