Commit Graph

32 Commits

Author SHA1 Message Date
google-labs-jules[bot] 86720090b6 docs: Add GoDoc to pkg and improve markdown files (#3251)
This change adds GoDoc comments to many of the public symbols in the
`pkg/` directory. It also includes various improvements to the
documentation in `README.md` and other markdown files in the `docs/`
directory.

This is a partial documentation effort, as requested by the user, to
get a pull request submitted quickly.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-09-22 19:37:15 +02:00
Dominik Schulz 7281ca8ab4 [chore] Migrate to golangci-lint v2 (#3104)
* [chore] Migrate to golangci-lint v2

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issue

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix more lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Add more package comments.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [chore] Fix golangci-lint config and the remaining checks

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Use Go 1.24

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix container builds

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix more failing tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix test failure

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Fix another len assertion

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Move location tests

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Fix most remaining lint issues

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Only run XDG specific tests on linux

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* [fix] Attempt to address on source of flaky failures

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-17 08:05:43 +02:00
Dominik Schulz d6669e15e5 chore: Switch to static list of linters (#2882)
* chore: Switch to static list of linters

The old approach was prone to random CI failures when a golangci-lint
was updated and did enable new linters. This approach means we will have
to update the include list from time to time but won't get random CI
failures.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* fix: Update enabled linters to be compatible with GHA

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2024-06-10 13:54:49 +02:00
Ludovic Fernandez b8f0ff8ff2 [chore]: linting (#2840)
Signed-off-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2024-03-25 19:32:57 +01:00
Yolan Romailler 5d945d6d00 [BUGFIX] Disabling the OTP snip screenshot feature on OpenBSD (#2685)
* [BUGFIX] Disabling the OTP snip screenshot feature because of syscall problems

Also do not rely on our dependency returning an error on Darwin and disable that too if it's not compiled with CGO

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* Applying code review comments

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-11-04 08:14:28 +01:00
Yolan Romailler d56639fcd7 [CLEANUP] Migration of options to more appropriate sections (#2681)
* [CLEANUP] Moving options to the correct config section

This adds an easy migration path to our config handling, which should
allow us to migrate option names around much more easily in the future.

Any system level config or env variables options are not migrated.

This also fixes a bug in our test code, where the root mount path was
not properly set in our config, because we used "path:" instead of
"path=" to set it.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [DOCUMENTATION] Document legacy options and their migration path

This also makes sure that legacy options aren't used in the code anymore using the docs test and its regexp

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Removing weird spaces from changelog

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [DOCUMENTATION] Reformatting our Markdown tables properly

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [TESTING] Patching a timezone bug in tests

This is a fun one where if your Timezone isn't UTC and you are past midnight but it's not past midnight UTC, the tests would fail because you're not using the right date to validate it.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Fix a typo and use the correct Env variables in the doc about the custom Env variables

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [BREAKING] Custom Env options moved from GOPASS_CONFIG_CONFIG_KEY_i to GOPASS_CONFIG_KEY_i

As discussed in #2617, this actually reflects the way GIT_CONFIG works.

It also fixes a potential Panic in our codebase when IsSet was called
without any Preset config on a non-existing key.

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [CLEANUP] Patching all of the new linter complaints

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [CLEANUP] Use Go1.21 everywhere

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] Increase our Golangci timeout

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [n/a] code review comment and extra regression test

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-11-03 18:40:58 +01:00
Yolan Romailler 439bc00268 fix: OTP screenshot only on ARM, ARM64, 386 and AMD64 (#2644)
Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-08-31 20:31:57 +02:00
Yolan Romailler 8c666a93d8 Fixing OTP screenshots build issues (#2630)
* Fixing OTP screenshots

using fixed dependency

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* Adding also openbsd to the supported list

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-08-01 10:08:07 +02:00
Dominik Schulz aeefd4f096 Fix build
The screenshot package does not build on most platforms.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-07-30 20:25:17 +02:00
Yolan Romailler eb6c1014b5 Adding screen parsing for OTP QR code (#2597)
* [FEATURE] Screen parsing for OTP QR code with 'otp -snip entry'
[CLEANUP] Fixing issues from linter

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* [CLEANUP] Updating our dependencies

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

* Tweaking license-lint.yml to accept these new deps

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>

---------

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2023-06-10 18:29:37 +02:00
Dominik Schulz e4a66c02ec Add test cases for #2462 and some minor cleanup (#2465)
RELEASE_NOTES=n/a

Fixes #2462

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-11 13:29:36 +01:00
Dominik Schulz f58454452f Increase test coverage (#2461)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-10 23:05:33 +01:00
Eng Zer Jun d2f64457fb test: use T.TempDir to create temporary test directory (#2377)
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-04 21:14:46 +02:00
Dominik Schulz 4dfb6492d8 Update deps. Bump to Go 1.19 (#2296)
RELEASE_NOTES=[CLEANUP] Use Go 1.19

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-08-02 21:41:43 +02:00
Dominik Schulz 4cb569a83c Use github.com/pquerna/otp to allow using the key period (#2278)
* Use github.com/pquerna/otp to allow using the key period

RELEASE_NOTES=[BUGFIX] Use OTP key period

Fixes #2276

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Address review comments.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Implement digits and algorithm parameter parsing

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Use proper formatting and add logging

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>

* Make linters happy

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-08-02 21:24:38 +02:00
Dominik Schulz 16c071a780 Enable golangci-lint on push and pr (#2158)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-24 21:58:53 +01:00
Dominik Schulz 117db90478 Update deps (#2168)
Ran 'make upgrade' (includes gofumpt).

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-17 20:55:53 +01:00
Dominik Schulz 0eff31a8ce Enable additional golangci-lint godot checks (#2077) 2021-12-29 22:47:53 +01:00
Yolan Romailler 6a8fb862df Linting some more code (#2074)
RELEASE_NOTES=n/a

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2021-12-28 15:50:46 +01:00
Dominik Schulz 73ed2c189e Upgrade to Go 1.16 (#1803)
Remove usage of io/ioutil: https://golang.org/doc/go1.16?s=03#ioutil

RELEASE_NOTES=[ENHANCEMENT] Use Go 1.16

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-02-17 21:39:07 +01:00
Dominik Schulz d9759ffec8 Replace github.com/pkg/errors by stdlib errors (#1750)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-26 09:21:52 +01:00
Dominik Schulz ddfe7bfc97 Remove final references to internal packages (#1709)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-14 09:15:29 +01:00
Dominik Schulz 5977752c7c Unexport more internal packages (#1380)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-22 21:38:08 +02:00
Dominik Schulz d0be4054ca Unexport more internal packages (#1377)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-22 18:26:01 +02:00
Dominik Schulz 22fd3b92ed Improve test coverage (#1330)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-05 22:33:24 +02:00
Dominik Schulz cd157a0f46 Introduce build tags (#1000)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2018-12-26 12:58:36 +01:00
Cole Mickens 597bbac79b otp: add tests (#1008)
Signed-off-by: Cole Mickens <cole.mickens@gmail.com>
2018-12-09 21:45:40 +01:00
Daniel P 90bb387735 This reverts regression of OTP in 1.8.3 (#1006)
* This reverts regression of OTP in 1.8.3

This breaks OTP entries using otpauth://totp/... format.

This simply make it work again.

Signed-off-by: Daniel Paquet <daniel.paquet@nokernel.com>

* Fix without removing code

Signed-off-by: Daniel Paquet <daniel.paquet@nokernel.com>

* Revert regression in OTP

Signed-off-by: Daniel Paquet <daniel.paquet@nokernel.com>
2018-12-07 06:31:46 +01:00
Cole Mickens dec28c3960 jsonapi: return totp in the api response to enable 2FA use in gopassbridge (#975)
* otp: return specific error if totp entry missing

Signed-off-by: Cole Mickens <cole.mickens@gmail.com>

* jsonapi: return otp in secret data if available

Signed-off-by: Cole Mickens <cole.mickens@gmail.com>
2018-11-11 23:10:30 +01:00
Dominik Schulz ba281c4942 Rewrite imports paths 2018-05-28 15:51:21 +02:00
Christian Muehlhaeuser 753045fc66 Follow import ordering & grouping conventions (#762)
Grouped in the following order:
1. Packages from the std library
2. golang.org imports
3. github.com/justwatchcom/gopass packages
4. External dependencies

Sorted by gofmt.
2018-05-05 09:40:02 +02:00
Dominik Schulz da436e6a79 Refactor and cleanup codebase (#715) 2018-03-16 14:22:47 +01:00