Skip to content

Commit

Permalink
feat: change pkg name format
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandrkhmil committed Jan 10, 2025
1 parent d48d410 commit eef04f1
Show file tree
Hide file tree
Showing 25 changed files with 61 additions and 49 deletions.
7 changes: 4 additions & 3 deletions cmd/service/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package main

import (
"basic_server/docs"
application "basic_server/internal"
"basic_server/internal/config"
"fmt"
"log"
"os"

"github.com/nix-united/golang-gin-boilerplate/docs"
application "github.com/nix-united/golang-gin-boilerplate/internal"
"github.com/nix-united/golang-gin-boilerplate/internal/config"

"github.com/joho/godotenv"
)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module basic_server
module github.com/nix-united/golang-gin-boilerplate

go 1.23.2

Expand Down
5 changes: 3 additions & 2 deletions internal/app.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package application

import (
"basic_server/internal/config"
"basic_server/internal/server"
"log"

"github.com/nix-united/golang-gin-boilerplate/internal/config"
"github.com/nix-united/golang-gin-boilerplate/internal/server"
)

func Start(cfg *config.Config) {
Expand Down
3 changes: 2 additions & 1 deletion internal/db/db.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package db

import (
"basic_server/internal/config"
"database/sql"
"fmt"
"time"

"github.com/nix-united/golang-gin-boilerplate/internal/config"

"gorm.io/driver/mysql"
"gorm.io/gorm"
)
Expand Down
7 changes: 4 additions & 3 deletions internal/handler/auth_handler.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package handler

import (
operror "basic_server/internal/errors"
"basic_server/internal/request"
"basic_server/internal/response"
"errors"
"net/http"

operror "github.com/nix-united/golang-gin-boilerplate/internal/errors"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
"github.com/nix-united/golang-gin-boilerplate/internal/response"

"github.com/gin-gonic/gin"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/handler/auth_handler_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions internal/handler/auth_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package handler_test

import (
"basic_server/internal/handler"
"basic_server/internal/request"
"basic_server/internal/service"
"bytes"
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"testing"

"github.com/nix-united/golang-gin-boilerplate/internal/handler"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
"github.com/nix-united/golang-gin-boilerplate/internal/service"

"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
9 changes: 5 additions & 4 deletions internal/handler/post_handler.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package handler

import (
"basic_server/internal/model"
"basic_server/internal/request"
"basic_server/internal/response"
"basic_server/internal/service"
"net/http"
"strconv"

"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
"github.com/nix-united/golang-gin-boilerplate/internal/response"
"github.com/nix-united/golang-gin-boilerplate/internal/service"

jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
)
Expand Down
9 changes: 5 additions & 4 deletions internal/provider/jwt_auth.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package provider

import (
"basic_server/internal/model"
"basic_server/internal/repository"
"basic_server/internal/request"
"basic_server/internal/utils"
"log"
"sync"
"time"

"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/repository"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
"github.com/nix-united/golang-gin-boilerplate/internal/utils"

jwt "github.com/appleboy/gin-jwt/v2"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
Expand Down
5 changes: 3 additions & 2 deletions internal/repository/mocks/user_repository_mock.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package mocks

import (
"basic_server/internal/model"
"basic_server/internal/repository"
"errors"

"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/repository"
)

type UserRepositoryMock struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/repository/mocks/users_repository_mockery.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/repository/post_repository.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package repository

import (
"basic_server/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/model"

"gorm.io/gorm"
)
Expand Down
3 changes: 2 additions & 1 deletion internal/repository/user_repository.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package repository

import (
"basic_server/internal/model"
"errors"

"github.com/nix-united/golang-gin-boilerplate/internal/model"

"gorm.io/gorm"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/repository/user_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"basic_server/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/model"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion internal/response/post_responses.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package response

import "basic_server/internal/model"
import "github.com/nix-united/golang-gin-boilerplate/internal/model"

type CreatePostResponse struct {
ID uint `json:"id"`
Expand Down
2 changes: 1 addition & 1 deletion internal/server/repository/post_repository.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package repository

import (
"basic_server/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/model"

"gorm.io/gorm"
)
Expand Down
3 changes: 2 additions & 1 deletion internal/server/repository/user_repository.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package repository

import (
"basic_server/internal/model"
"errors"

"github.com/nix-united/golang-gin-boilerplate/internal/model"

"gorm.io/gorm"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/server/routes.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package server

import (
"basic_server/internal/handler"
"basic_server/internal/provider"
"basic_server/internal/repository"
"basic_server/internal/service"
"basic_server/internal/utils"
"github.com/nix-united/golang-gin-boilerplate/internal/handler"
"github.com/nix-united/golang-gin-boilerplate/internal/provider"
"github.com/nix-united/golang-gin-boilerplate/internal/repository"
"github.com/nix-united/golang-gin-boilerplate/internal/service"
"github.com/nix-united/golang-gin-boilerplate/internal/utils"

swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
Expand Down
4 changes: 2 additions & 2 deletions internal/server/server.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package server

import (
"basic_server/internal/config"
"basic_server/internal/db"
"github.com/nix-united/golang-gin-boilerplate/internal/config"
"github.com/nix-united/golang-gin-boilerplate/internal/db"

"github.com/gin-gonic/gin"
"gorm.io/gorm"
Expand Down
2 changes: 1 addition & 1 deletion internal/server/service/post_service.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package service

import (
"basic_server/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/model"

"gorm.io/gorm"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/service/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package service

import "basic_server/internal/errors"
import "github.com/nix-united/golang-gin-boilerplate/internal/errors"

type RestError struct {
Status int `json:"Status"`
Expand Down
5 changes: 3 additions & 2 deletions internal/service/post_service.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package service

import (
"basic_server/internal/model"
"basic_server/internal/repository"
"net/http"

"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/repository"
)

type PostServiceI interface {
Expand Down
5 changes: 3 additions & 2 deletions internal/service/user_service.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package service

import (
"basic_server/internal/model"
"basic_server/internal/request"
"fmt"

"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
)

//go:generate mockgen -source=$GOFILE -destination=user_service_mock_test.go -package=${GOPACKAGE}_test -typed=true
Expand Down
2 changes: 1 addition & 1 deletion internal/service/user_service_mock_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions internal/service/user_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"errors"
"testing"

srverrors "basic_server/internal/errors"
"basic_server/internal/model"
"basic_server/internal/request"
"basic_server/internal/service"
srverrors "github.com/nix-united/golang-gin-boilerplate/internal/errors"
"github.com/nix-united/golang-gin-boilerplate/internal/model"
"github.com/nix-united/golang-gin-boilerplate/internal/request"
"github.com/nix-united/golang-gin-boilerplate/internal/service"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down

0 comments on commit eef04f1

Please sign in to comment.