Skip to content

Commit 97a5671

Browse files
authored
*: Refactor the generator package (#3)
Signed-off-by: timflannagan <[email protected]>
1 parent dd60e23 commit 97a5671

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

internal/changelog/generator.go renamed to internal/generator/generator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package changelog
1+
package generator
22

33
import (
44
"context"
@@ -28,8 +28,8 @@ type Generator struct {
2828
repo string
2929
}
3030

31-
// NewGenerator creates a new changelog generator
32-
func NewGenerator(client *github.Client, owner, repo string) *Generator {
31+
// New creates a new changelog generator
32+
func New(client *github.Client, owner, repo string) *Generator {
3333
return &Generator{
3434
client: client,
3535
owner: owner,

internal/changelog/changelog_test.go renamed to internal/generator/generator_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package changelog_test
1+
package generator_test
22

33
import (
44
"context"
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/google/go-github/v68/github"
1313
"github.com/gorilla/mux"
14-
"github.com/kgateway-dev/changelog-generator/internal/changelog"
14+
"github.com/kgateway-dev/changelog-generator/internal/generator"
1515
"github.com/migueleliasweb/go-github-mock/src/mock"
1616
)
1717

@@ -71,7 +71,7 @@ func TestGenerateChangelog_Mocked(t *testing.T) {
7171
ghClient := github.NewClient(mockedHTTPClient)
7272

7373
// Create changelog generator
74-
generator := changelog.NewGenerator(ghClient, "foo", "bar")
74+
generator := generator.New(ghClient, "foo", "bar")
7575

7676
// Generate changelog
7777
changelog, err := generator.Generate(context.Background(), "start-sha", "end-sha")

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77

88
"github.com/google/go-github/v68/github"
9-
"github.com/kgateway-dev/changelog-generator/internal/changelog"
9+
"github.com/kgateway-dev/changelog-generator/internal/generator"
1010
"github.com/spf13/cobra"
1111
)
1212

@@ -21,7 +21,7 @@ func main() {
2121
ctx := context.Background()
2222
client := github.NewClient(nil).WithAuthToken(token)
2323

24-
g := changelog.NewGenerator(client, owner, repo)
24+
g := generator.New(client, owner, repo)
2525
changelog, err := g.Generate(ctx, startSHA, endSHA)
2626
if err != nil {
2727
return fmt.Errorf("failed to generate changelog: %v", err)

0 commit comments

Comments
 (0)