![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
github.com/sliide/clock
Time utility with lovely mocking support.
This is essentially a replacement for the time
package which allows you to seamlessly swap in mock times, timers, and tickers. See the godocs (link above) for more detailed usage.
hello.go
package main
import (
"fmt"
"github.com/mixer/clock"
)
func main() {
fmt.Printf("the time is %s", displayer{clock.C}.formatted())
}
type displayer struct {
c clock.Clock
}
func (d displayer) formatted() string {
now := d.c.Now()
return fmt.Sprintf("%d:%d:%d", now.Hour(), now.Minute(), now.Second())
}
hello_test.go
package main
import (
"testing"
"time"
"github.com/mixer/clock"
"github.com/stretchr/testify/assert"
)
func TestDisplaysCorrectly(t *testing.T) {
date, _ := time.Parse(time.UnixDate, "Sat Mar 7 11:12:39 PST 2015")
c := clock.NewMockClock(date)
d := displayer{c}
assert.Equal(t, "11:12:39", d.formatted())
c.AddTime(42 * time.Second)
assert.Equal(t, "11:13:21", d.formatted())
}
The API provided by this package and the mock version is nearly identical to that of the time
package, with two notable differences:
.Chan()
method, rather than reading the .C
property. This allows the structures to be swapped out for their mock variants..AddTime
/.SetTime
on the mock clock without having to advance to each "ticked" time.FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.