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 48dbb57 commit d3a59d0
Show file tree
Hide file tree
Showing 25 changed files with 70 additions and 59 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.21

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
11 changes: 6 additions & 5 deletions internal/handler/auth_handler.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package handler

import (
operror "basic_server/internal/errors"
"basic_server/internal/request"
"basic_server/internal/response"
"basic_server/internal/service"
"basic_server/internal/utils"
"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/nix-united/golang-gin-boilerplate/internal/service"
"github.com/nix-united/golang-gin-boilerplate/internal/utils"

"github.com/gin-gonic/gin"
"golang.org/x/crypto/bcrypt"
)
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
7 changes: 4 additions & 3 deletions internal/handler/register_handler_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package handler

import (
"basic_server/internal/model"
"basic_server/internal/repository/mocks"
"bytes"
"net/http"
"net/http/httptest"
"testing"

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

"github.com/go-playground/assert/v2"

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

"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
10 changes: 5 additions & 5 deletions internal/server/handler/register_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package handler
import (
"net/http"

operror "basic_server/internal/errors"
"basic_server/internal/request"
"basic_server/internal/response"
"basic_server/internal/service"
"basic_server/internal/utils" //nolint
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/nix-united/golang-gin-boilerplate/internal/service"
"github.com/nix-united/golang-gin-boilerplate/internal/utils" //nolint

"golang.org/x/crypto/bcrypt"

Expand Down
8 changes: 4 additions & 4 deletions internal/server/handler/register_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"os"
"testing"

"basic_server/internal/config"
"basic_server/internal/db"
"basic_server/internal/repository"
"basic_server/internal/service"
"github.com/nix-united/golang-gin-boilerplate/internal/config"
"github.com/nix-united/golang-gin-boilerplate/internal/db"
"github.com/nix-united/golang-gin-boilerplate/internal/repository"
"github.com/nix-united/golang-gin-boilerplate/internal/service"

"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
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
8 changes: 4 additions & 4 deletions internal/server/routes.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package server

import (
"basic_server/internal/handler"
"basic_server/internal/provider"
"basic_server/internal/repository"
"basic_server/internal/service"
"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"

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
8 changes: 4 additions & 4 deletions internal/service/user_service.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package service

import (
"basic_server/internal/model"
"basic_server/internal/repository"
"basic_server/internal/request"
"basic_server/internal/utils"
"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"
)

// UserServiceI provides a use case level for the user entity
Expand Down
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"

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

"github.com/stretchr/testify/assert"
"gorm.io/gorm"
Expand Down

0 comments on commit d3a59d0

Please sign in to comment.