mattermost-plugin-shelfmark/go.mod
Felipe M. 98f5c6d446
Fix concurrency bugs, error handling, and add comprehensive unit tests
Address 18 issues identified in codebase review:

- Fix doRequest body consumed on 401 retry by accepting []byte instead of io.Reader
- Fix race condition on httpClient.Timeout in DownloadFile using context.WithTimeout
- Fix data race on baseURL read in doRequest by reading under mutex
- Add sync.Mutex to taskStore for atomic index operations
- Replace all silent `_ = SaveTask()` calls with proper error logging via failTask helper
- Add notifyRequester calls to all processTaskComplete failure paths
- Mark missing Shelfmark tasks as failed instead of optimistically promoting to complete
- Remove goto in processTaskPending with structured control flow
- Validate ShelfmarkHost URL scheme in IsValid()
- Call IsValid() in OnConfigurationChange to warn on invalid config
- Guard ExecuteCommand against empty command panic
- Add EffectiveTitle() method on DownloadTask to deduplicate title fallback
- Add shelfmarkCredentials() to deduplicate TrimSpace calls
- Log ReleasesResponse.Errors when non-empty
- Batch-delete terminal tasks in ListActiveTasks instead of during iteration
- Log GetTask errors in ListActiveTasks instead of silently skipping
- Properly handle resp.Body.Close() errors throughout shelfmark client
- Add 93 unit tests across 8 new test files covering all packages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:17:38 +01:00

61 lines
2.7 KiB
Modula-2

module git.nakama.town/fmartingr/mattermost-plugin-shelfmark
go 1.25
require (
github.com/mattermost/mattermost/server/public v0.1.21
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.11.1
)
require (
github.com/beevik/etree v1.6.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.7.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/jonboulle/clockwork v0.5.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect
github.com/mattermost/gosaml2 v0.10.0 // indirect
github.com/mattermost/ldap v0.0.0-20231116144001-0f480c025956 // indirect
github.com/mattermost/logr/v2 v2.0.22 // indirect
github.com/mattermost/mattermost/server/v8 v8.0.0-20251014075701-833e0125320d // indirect
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/oklog/run v1.2.0 // indirect
github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/russellhaering/goxmldsig v1.5.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/tinylib/msgp v1.4.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/wiggin77/merror v1.0.5 // indirect
github.com/wiggin77/srslog v1.0.1 // indirect
golang.org/x/crypto v0.43.0 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/net v0.46.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.30.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff // indirect
google.golang.org/grpc v1.76.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)