Skip to content

Commit 0b3ae6e

Browse files
authored
Merge pull request #38 from srishtea-22/refactor/project-structure
refactor: restructure project to follow Go conventions
2 parents 873a1fe + b9d64dd commit 0b3ae6e

18 files changed

Lines changed: 25 additions & 25 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ jobs:
7878
- name: Build
7979
run: |
8080
if [ "${{ matrix.os }}" = "windows-latest" ]; then
81-
go build -v -o ${{ matrix.artifact_name }} -ldflags="-s -w" ./src
81+
go build -v -o ${{ matrix.artifact_name }} -ldflags="-s -w" ./cmd/commit-msg
8282
else
83-
go build -v -o ${{ matrix.artifact_name }} -ldflags="-s -w" ./src
83+
go build -v -o ${{ matrix.artifact_name }} -ldflags="-s -w" ./cmd/commit-msg
8484
fi
8585
shell: bash
8686

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ Improving documentation is always appreciated:
104104
3. Run the application:
105105

106106
```bash
107-
go run src/main.go .
107+
go run cmd/commit-msg/main.go .
108108
```
109109

110110
4. Build the executable:
111111
```bash
112-
go build -o commit.exe src/main.go
112+
go build -o commit.exe cmd/commit-msg/main.go
113113
```
114114

115115
### Testing Your Changes

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
Below is a sample execution of `commit-msg`:
1313

14-
![Commit-msg GIF](commit.gif)
14+
![Commit-msg GIF](assets/commit.gif)
1515

1616
Before running the application, ensure you have set the system environment variables. and add commit.exe to path variables (same for linux macOS)
1717

@@ -102,7 +102,7 @@ cd commit-msg
102102
go mod download
103103

104104
# Build the executable
105-
go build -o commit src/main.go
105+
go build -o commit cmd/commit-msg/main.go
106106

107107
# (Optional) Install to GOPATH
108108
go install
@@ -123,7 +123,7 @@ commit .
123123
Or if running from source:
124124

125125
```bash
126-
go run src/main.go .
126+
go run cmd/commit-msg/main.go .
127127
```
128128

129129
### Example Workflow
File renamed without changes.
File renamed without changes.

src/main.go renamed to cmd/commit-msg/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import (
55
"os"
66

77
"github.com/atotto/clipboard"
8-
"github.com/dfanso/commit-msg/src/chatgpt"
9-
"github.com/dfanso/commit-msg/src/claude"
10-
"github.com/dfanso/commit-msg/src/gemini"
11-
"github.com/dfanso/commit-msg/src/grok"
12-
"github.com/dfanso/commit-msg/src/internal/display"
13-
"github.com/dfanso/commit-msg/src/internal/git"
14-
"github.com/dfanso/commit-msg/src/internal/stats"
15-
"github.com/dfanso/commit-msg/src/types"
8+
"github.com/dfanso/commit-msg/internal/chatgpt"
9+
"github.com/dfanso/commit-msg/internal/claude"
10+
"github.com/dfanso/commit-msg/internal/display"
11+
"github.com/dfanso/commit-msg/internal/gemini"
12+
"github.com/dfanso/commit-msg/internal/git"
13+
"github.com/dfanso/commit-msg/internal/grok"
14+
"github.com/dfanso/commit-msg/internal/stats"
15+
"github.com/dfanso/commit-msg/pkg/types"
1616
"github.com/pterm/pterm"
1717
)
1818

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
openai "github.com/openai/openai-go/v3"
88
"github.com/openai/openai-go/v3/option"
99

10-
"github.com/dfanso/commit-msg/src/types"
10+
"github.com/dfanso/commit-msg/pkg/types"
1111
)
1212

1313
func GenerateCommitMessage(config *types.Config, changes string, apiKey string) (string, error) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"fmt"
88
"net/http"
99

10-
"github.com/dfanso/commit-msg/src/types"
10+
"github.com/dfanso/commit-msg/pkg/types"
1111
)
1212

1313
type ClaudeRequest struct {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/google/generative-ai-go/genai"
88
"google.golang.org/api/option"
99

10-
"github.com/dfanso/commit-msg/src/types"
10+
"github.com/dfanso/commit-msg/pkg/types"
1111
)
1212

1313
func GenerateCommitMessage(config *types.Config, changes string, apiKey string) (string, error) {

0 commit comments

Comments
 (0)