Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ on:
push:
branches:
- develop

env:
GO_VERSION: "1.22.6"

jobs:
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Godel Verify
run: ./godelw verify
6 changes: 3 additions & 3 deletions examples/signal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ func main() {
jsonConfig := writer.NewOutputConfig(nil, writer.NewFormat(writer.JSON))
yamlConfig := writer.NewOutputConfig(nil, writer.NewFormat(writer.YAML))

_ = writer.Write(report, signalConfig, startedAt, &startedAt, status, nil)
_ = writer.Write(report, signalConfig, &startedAt, &startedAt, status, nil)
fmt.Println()
fmt.Println()
_ = writer.Write(report, jsonConfig, startedAt, &startedAt, status, nil)
_ = writer.Write(report, jsonConfig, &startedAt, &startedAt, status, nil)
fmt.Println()
fmt.Println()
_ = writer.Write(report, yamlConfig, startedAt, &startedAt, status, nil)
_ = writer.Write(report, yamlConfig, &startedAt, &startedAt, status, nil)

os.Exit(0)
}
12 changes: 10 additions & 2 deletions signal/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"encoding/base64"
"fmt"
"time"

"github.com/palantir/pkg/datetime"
"github.com/palantir/pkg/safejson"
Expand All @@ -22,10 +23,17 @@ type Signal struct {
ErrorMessage *string `json:"error_message,omitempty" yaml:"error_message,omitempty"`
}

func NewSignal(content any, startedAt datetime.DateTime, completedAt *datetime.DateTime, status int, errorMessage *string) Signal {
func NewSignal(content any, startedAt *datetime.DateTime, completedAt *datetime.DateTime, status int, errorMessage *string) Signal {
var startedAtTime datetime.DateTime
if startedAt == nil {
startedAtTime = datetime.DateTime(time.Now())
} else {
startedAtTime = *startedAt
}

return Signal{
Content: content,
StartedAt: startedAt,
StartedAt: startedAtTime,
CompletedAt: completedAt,
Status: status,
ErrorMessage: errorMessage,
Expand Down
4 changes: 2 additions & 2 deletions signal/signal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestSignal_EncodeContent(t *testing.T) {
// Create a sample Signal instance
now := datetime.DateTime(time.Now())
content := "Sample content"
signal := sig.NewSignal(content, now, nil, 200, nil)
signal := sig.NewSignal(content, &now, nil, 200, nil)

// Encode the content
err := signal.EncodeContent()
Expand All @@ -66,7 +66,7 @@ func TestSignal_AddError(t *testing.T) {
// Create a sample Signal instance
now := datetime.DateTime(time.Now())
content := "Sample content"
signal := sig.NewSignal(content, now, nil, 200, nil)
signal := sig.NewSignal(content, &now, nil, 200, nil)

// Add an error to the Signal
err := errors.New("Sample error")
Expand Down
2 changes: 1 addition & 1 deletion writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func Write(
report any,
config OutputConfig,
startedAt datetime.DateTime,
startedAt *datetime.DateTime,
completedAt *datetime.DateTime,
status int,
errorMessage *string,
Expand Down
2 changes: 1 addition & 1 deletion writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestWrite(t *testing.T) {
// Run test cases
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
err := writer.Write(tc.report, tc.config, tc.startedAt, tc.completedAt, tc.status, tc.errorMessage)
err := writer.Write(tc.report, tc.config, &tc.startedAt, tc.completedAt, tc.status, tc.errorMessage)
if err != nil && err.Error() != tc.expectedErr.Error() {
t.Errorf("Unexpected error while encoding content: %v", err)
}
Expand Down