Skip to content

Commit

Permalink
整理文件
Browse files Browse the repository at this point in the history
  • Loading branch information
celt237 committed Jul 2, 2024
1 parent da94ff1 commit 44a0e40
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 41 deletions.
2 changes: 1 addition & 1 deletion internal/annotationParser.go → annotationParser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion internal/annotation_test.go → annotation_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion internal/astParser.go → astParser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion internal/config.go → config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

const AnnotationPrefix = "@"

Expand Down
2 changes: 1 addition & 1 deletion internal/fileParser.go → fileParser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"fmt"
Expand Down
File renamed without changes.
12 changes: 5 additions & 7 deletions go-annotation.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
package go_annotation

import "github.com/celt237/go-annotation/internal"

// GetFileDesc 获取文件描述
// fileName: 文件名
func GetFileDesc(fileName string) (*internal.FileDesc, error) {
return internal.GetFileParser(fileName).Parse()
func GetFileDesc(fileName string) (*FileDesc, error) {
return GetFileParser(fileName).Parse()
}

// GetFilesDescList 获取文件描述列表
// directory: 目录
func GetFilesDescList(directory string) ([]*internal.FileDesc, error) {
var filesDesc []*internal.FileDesc
func GetFilesDescList(directory string) ([]*FileDesc, error) {
var filesDesc []*FileDesc
// 读取目录下的所有文件
fileNames, err := internal.GetFileNames(directory)
fileNames, err := GetFileNames(directory)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaceParser.go → interfaceParser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion internal/model.go → model.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

type AnnotationMode string // 注解模式

Expand Down
2 changes: 1 addition & 1 deletion internal/structParser.go → structParser.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package internal
package go_annotation

import (
"go/ast"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package arraymode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// InterfaceTwo test
// @annotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "arraymode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/arraymode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/arraymode",
"FileName": "arraymode_mult.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Interfaces": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down Expand Up @@ -176,7 +176,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package arraymode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// InterfaceOne test
// @annotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "arraymode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/arraymode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/arraymode",
"FileName": "arraymode_single_interface.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Interfaces": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package arraymode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// StructOne test
// @annotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "arraymode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/arraymode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/arraymode",
"FileName": "arraymode_single_struct.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Structs": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mapmode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// InterfaceTwo test
// @annotation(id="1", name="test")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "mapmode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/mapmode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/mapmode",
"FileName": "mapmode_mult.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Interfaces": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down Expand Up @@ -176,7 +176,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mapmode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// InterfaceOne test
// @annotation(id="1", name="test")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "mapmode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/mapmode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/mapmode",
"FileName": "mapmode_single_interface.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Interfaces": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mapmode

import "github.com/celt237/go-annotation/internal/test/data"
import (
"github.com/celt237/go-annotation/test/data"
)

// StructOne test
// @annotation(id="1", name="test")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"PackageName": "mapmode",
"FullPackageName": "github.com/celt237/go-annotation/internal/test/data/mapmode",
"FullPackageName": "github.com/celt237/go-annotation/test/data/mapmode",
"FileName": "mapmode_single_struct.go",
"Imports": {
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Structs": [
Expand All @@ -16,7 +16,7 @@
"data": {
"Name": "data",
"HasAlias": false,
"Path": "github.com/celt237/go-annotation/internal/test/data"
"Path": "github.com/celt237/go-annotation/test/data"
}
},
"Comments": [
Expand Down
File renamed without changes.

0 comments on commit 44a0e40

Please sign in to comment.