39 Commits

Author SHA1 Message Date
Dominik Schulz
71861e4a8b
chore: Update golangci-lint (#3287)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-11-12 21:09:26 +01:00
Dominik Schulz
ab22687ee3
[fix] Update Makefile and fix lint violations (#3134)
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-21 20:27:19 +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
7eaa845da7
[fix] Fix test regressions (#3116)
* [fix] Fix test regressions

This change fixes some tests that did start to fail at some point.
I can't tell for sure when they broke (didn't bisect) and if that
breakage is isolated to my system or not. But I need to fix them
anyway.

Fixes #3115

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

* Add missing files.

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

* Fix test failure

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

* Fix one more version test

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2025-04-16 21:21:00 +02:00
Dominik Schulz
263b78119b
[bugfix] Fix writes to global config from tests (#2727)
* [bugfix] Fix writes to global config from tests

Fixes #2725

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

* Shorten readonly config creation.

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

* Address review comments

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

---------

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2023-12-01 14:04:17 +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
Dominik Schulz
c702df1ce1
Add some hooks (#2499)
* Add some hooks

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

* Add generic hooks

Fixes #2500

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

* Address some review comments and fix some tests.

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

* Document options

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

* Error formatting

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-31 13:47:13 +01:00
Dominik Schulz
7b0028100b
Remove flaky vim detection test (#2470)
There is no good way to test these in isolation right now.

RELEASE_NOTES=n/a

Fixes #2469

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-13 08:59:45 +01:00
Dominik Schulz
d9199cd9c2
Incorporate cleanup and simplifications ideas from kpitt/gopass (#2468)
* Improve test isolation

These test shouldn't pick up user configs.

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

* Use correct flag names for rcs init test

These flags must use the canonical names since they are not processed
by the CLI library and as such aliases are not applied.

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

* Remove obsolete warning in fsck help

The default format should be fully compatible with other
password store implementations.

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

* Remove unused "Verbose" context property

This was never set anywhere, so we can safely remove it.

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

* Remove --clip option for the find command

When this is invoked as `gopass find` there is actually no
code path that leads to this flag being used.

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

* Remove mount versions from the `version` command

The `version` command should generally only print the version and not
load the full config, trigger auto-sync and other operations the
happend when initializing the mounts.

Moving the mount point information to the new `mounts versions` command.

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

* Update find integration test

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

* Do not run auto-sync if the command is `sync`

Otherwise sync might run twice.

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

* Reset auto-sync if a full `sync` succeeds

Since a `gopass sync` without the `--store` option is the same
operation as an auto-sync we should reset the interval if it
was successfull.

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

* Remove sync messages about importing and exporting keys

These usually don't take a lot of time and don't need a mention unless
they fail.

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

* Refactor OTP action to reduce code complexity and duplication

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

* Clean up outdated Git documentation

`gopass` isn't configuring `git` to sign commits anymore.

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-11 23:08:46 +01: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
Eng Zer Jun
840fb827ac
test: use T.Setenv to set env vars in tests (#2463)
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

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

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-12-11 12:51:59 +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
Dominik Schulz
0ebf65fa2d
Fix vim detection. Again. (#2456)
Fixes #2424

RELEASE_NOTES=[BUGFIX] Fix vim invocation.

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-12-07 09:08:45 +01:00
Dominik Schulz
6dba8a7266
Drop all options when we are not sure if EDITOR is vim (#2427)
Fixes #2424

RELEASE_NOTES=[BUGFIX] Improve support for non-vim editors

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-11-25 09:52:12 +01:00
Dominik Schulz
8b40aa307a
Try to identify vim variants (#2421)
Fixes #2412

RELEASE_NOTES=[BUGFIX] Only pass vim options to vim

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-11-22 09:05:25 +01:00
Dominik Schulz
ce3c52182a
Handle vim variant nvi (#2414)
RELEASE_NOTES=[BUGFIX] Handle nvi

Fixes #2412

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-11-18 18:34:51 +01:00
Dominik Schulz
555d512e9c Deflake tests
Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-09-28 19:02:30 +02:00
Dominik Schulz
cb634f813d
Set vim options instead of sniffing the config (#2343)
* Set vim options instead of sniffing the config

Fixes #2317

RELEASE_NOTES=[ENHANCEMENT] Set vim options instead of sniffing

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

* Add a note on vim hardening flags to the docs.

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

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-09-20 22:08:23 +02:00
BoostCookie
4f862dd9e8
Correct (neo)vim settings (#2318)
The previous recommended vim settings still allowed data to leak into
the .viminfo file
For Linux even the matching path was wrong which means that the
(insufficient) rules were not even used.

RELEASE_NOTES=[DOCUMENTATION] fix in recommended vim setting

Signed-off-by: Stefan Gehr <stefangehr@protonmail.com>

Signed-off-by: Stefan Gehr <stefangehr@protonmail.com>
2022-09-02 18:07:28 +02:00
Dominik Schulz
1af680ea4b
Use go.gopass.pw for shorter URLs (#2287)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-07-29 17:20:23 +02:00
Dominik Schulz
57ad454163
Fix linter issues (#2273)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-07-17 18:01:33 +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
5eceae1f86
Try gocritic (#2169)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-03-17 21:07:55 +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
3d3c7d5b77
GCI-ing imports (#2072)
Running gci in order to make sure we have properly deterministic imports

RELEASE_NOTES=n/a

Signed-off-by: Yolan Romailler <anomalroil@users.noreply.github.com>
2021-12-28 13:59:31 +01:00
Dominik Schulz
8586105f27
Update deps (#1981)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-08-28 16:01:27 +02: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
08b7d56d65
Add suffix f to formating out methods (#1794)
This commit renames the existing out methods that expect
a format string to include the common f suffix and introduces
new out methods without this suffix that don't accept a
format string or variadic arguments.

Fixes #1793

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-02-15 19:38:58 +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
ff349772ac
Reduce dependencies on internal packages (#1707)
This PR moves some packages from internal to pkg to increase the
independence of binaries in cmd/ from internal packages further.

RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2021-01-13 18:21:09 +01:00
Yolan Romailler
fb2553bba0
Disable input parsing (#1681)
Fixes #1602
Fixes #1614
Fixes #1600
Fixes #1594
Fixes #1601
Fixes #1650

RELEASE_NOTES=[BUGFIX] Disabling all kind of parsing of the input
RELEASE_NOTES=[ENHANCEMENT] Adding the flag show -n to disable output parsing
RELEASE_NOTES=[ENHANCEMENT] Adding the option parsing to disable all parsing

Signed-off-by: Yolan Romailler <yolan@romailler.ch>
2021-01-07 21:53:06 +01:00
oliverpool
21b518fce4
Link to doc on vim potential leak (#1653)
RELEASE_NOTES=n/a

Signed-off-by: Olivier Charvin <git@olivier.pfad.fr>
2020-11-15 09:19:23 +01:00
Dominik Schulz
0a79e88a1b
Check .vimrc for possible misconfiguration (#1494)
Fixes #1489

RELEASE_NOTES=[ENHANCEMENT] Warn if vim might be leaking secrets

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-08-11 07:20:07 +02:00
Dominik Schulz
e623b38665
Cleanup interfaces (#1401)
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-31 09:52:17 +02:00
Dominik Schulz
0cfa536d28
Add debug package (#1396)
This commit adds a new debug package to gopass.
It is heavily inspired by github.com/restic/restic/internal/debug
and adapted for the gopass use case.

This change allows to further trim down the source code since the
new package doesn't propagate the debug flag in the context anymore.
As such we can now omit passing ctx in most places.

In order to ensure we don't accidentially keep passing ununsed
parameters we also introduce unparam to check for extra arguments.

RELEASE_NOTES=[ENHANCEMENT] New Debug package

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-29 13:47:35 +02:00
Dominik Schulz
264d139fe5
Add initial draft of the gopass API (#1385)
This commit contains the initial draft of the gopass API.
Design and implementation of the API are work in progress - even after
this PR has been merged. Feedback welcome but please use with caution.
Expect breaking changes to the API. Especially once we redesign the
secrets implementation.

Fixes #1379

RELEASE_NOTES=[ENHANCEMENT] Add gopass API (unstable)

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2020-05-24 21:03:54 +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