mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
* feat: add golangci-lint linting * chore: fix linter issues * feat: add linting into the workflow * docs: update lint docs * fix: cr suggestions * fix: remove old formatting and vetting scripts * fix: add docker make target * fix: action go caching * fix: depreciated actions checkout version * fix: cr suggestion * fix: cr suggestions --------- Co-authored-by: Manu Gupta <manugupt1@gmail.com>
48 lines
2.1 KiB
Go
48 lines
2.1 KiB
Go
package storage
|
|
|
|
import "time"
|
|
|
|
// Origin is taken from https://pkg.go.dev/cmd/go/internal/modfetch/codehost#Origin.
|
|
type Origin struct {
|
|
VCS string `json:",omitempty"` // "git" etc
|
|
URL string `json:",omitempty"` // URL of repository
|
|
Subdir string `json:",omitempty"` // subdirectory in repo
|
|
|
|
// If TagSum is non-empty, then the resolution of this module version
|
|
// depends on the set of tags present in the repo, specifically the tags
|
|
// of the form TagPrefix + a valid semver version.
|
|
// If the matching repo tags and their commit hashes still hash to TagSum,
|
|
// the Origin is still valid (at least as far as the tags are concerned).
|
|
// The exact checksum is up to the Repo implementation; see (*gitRepo).Tags.
|
|
TagPrefix string `json:",omitempty"`
|
|
TagSum string `json:",omitempty"`
|
|
|
|
// If Ref is non-empty, then the resolution of this module version
|
|
// depends on Ref resolving to the revision identified by Hash.
|
|
// If Ref still resolves to Hash, the Origin is still valid (at least as far as Ref is concerned).
|
|
// For Git, the Ref is a full ref like "refs/heads/main" or "refs/tags/v1.2.3",
|
|
// and the Hash is the Git object hash the ref maps to.
|
|
// Other VCS might choose differently, but the idea is that Ref is the name
|
|
// with a mutable meaning while Hash is a name with an immutable meaning.
|
|
Ref string `json:",omitempty"`
|
|
Hash string `json:",omitempty"`
|
|
|
|
// If RepoSum is non-empty, then the resolution of this module version
|
|
// failed due to the repo being available but the version not being present.
|
|
// This depends on the entire state of the repo, which RepoSum summarizes.
|
|
// For Git, this is a hash of all the refs and their hashes.
|
|
RepoSum string `json:",omitempty"`
|
|
}
|
|
|
|
// RevInfo is json-encodable into the response body for
|
|
// GET baseURL/module/@v/version.info
|
|
// from https://pkg.go.dev/cmd/go/internal/modfetch/codehost#RevInfo.
|
|
type RevInfo struct {
|
|
Origin *Origin
|
|
Name string // complete ID in underlying repository
|
|
Short string // shortened ID, for use in pseudo-version
|
|
Version string // version used in lookup
|
|
Time time.Time // commit time
|
|
Tags []string // known tags for commit
|
|
}
|