Commit Graph

13 Commits

Author SHA1 Message Date
Dave Protasowski 8535fcc248
gofumpt the repo (#3067)
* gofumpt the repo

* don't prefix numbers with 0 - otherwise they're octal
2024-06-25 07:27:07 +00:00
Vincent Demeester dc1fae1337
changeset: allow override the revision through ldflags (#2601)
The main reason for this is to support cases where the `go build`
happens on a non git folder but we want to pass a revision anyway.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2022-11-02 20:10:08 +00:00
Dave Protasowski 3764d73bf9
fix linting (#2555) 2022-07-22 15:28:21 +00:00
Dave Protasowski 1ad02a5662
Drop error from changeset.Get signature (#2549)
* Drop error from changeset.Get signature

We simply return 'unknown'

* update mako/sidecar's use of changeset
2022-07-18 16:36:59 +00:00
Dave Protasowski 473ba31eb9
Bump min go version to 1.18 && read build info from embedded binary (#2548)
* Bump min go version to 1.18 & read build SHA from binary

* GitHub Commit ID is really a Git Revision

* update go.sum

* fix spelling

* Address PR feedback

- Use a sync.Once to prevent double parsing
- Support SHA256
- Allow non-SHA revision strings

* Don't include 'unknown' revision value in logs
2022-07-18 14:57:59 +00:00
Pierangelo Di Pilato a850b9e047
Use t.Setenv instead of os.Setenv in tests (#2454)
Go 1.17 introduced a new handy API for setting env vars scoped for
a single test so we can avoid the hard to read set and reset env
loops.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2022-03-10 10:00:48 -08:00
Billy Lynch 3b550aff99
changeset: Look in packed-refs file if ref file not found. (#2425)
If you have a lot of refs in a repo, git will eventually start
condensing them into a single file instead of letting them sprawl out in
separate directories on the filesystem. This change lets the changeset
package use the packed-refs file as a fall back in the event that the
ref file is not found.

See https://git-scm.com/docs/git-pack-refs for more details on packed
refs.
2022-02-17 07:28:13 -08:00
Victor Agababov a371418524
v2 (#1754) 2020-09-29 13:18:29 -07:00
Victor Agababov 7e6f1f48c9 Some cleanups to the changeset code (#577) 2019-08-15 11:22:08 -07:00
Matt Moore 426561fd09 Add support for resolving refs, when linked. (#576)
With https://github.com/google/ko/pull/73 we can link the Git ref information
into images with:
```
ln -r -s .git/refs ./cmd/foo/kodata
```

If the changeset package gets a `ref: <ref>` entry, it attempts to read that
file from `KO_DATA_PATH` next, which lets the changeset work much more effectively.
2019-08-15 10:01:08 -07:00
Victor Agababov a330baa9b0 Grep fix formatting issues (#233)
* Some fixes to the spoof.go and exporter.go

While reviewing some other CL, I saw some avenues for improving
spoof.go, to log the URL that's being fetched, which would help in test
debugging and to use switch construct, rather than nested if's.

While testing the change, I noticed some shifty loggin from the
exporter, so I fixed that as well while I was there.

* Continuation of the previous cleanups.

* Fix the issues with formatting by executing a grep

* and fix compilation error

* lowercase error

* fix the newly changed unit test
2019-01-18 14:33:32 -08:00
mattmoor-sockpuppet d99eb0732f Run gofmt (#171)
Produced via: `gofmt -s -w $(find -name '*.go' | grep -v vendor)`
2018-11-26 07:18:22 -08:00
Yanwei Guo 088e3f7faf Add the commit ID key as constant for log label (#158)
* add the commit id constant

* add changeset lib

* add doc.go with explanation
2018-11-06 14:59:36 -08:00