Skip to content

Commit 2308588

Browse files
committed
[feat]Add README and update CLI usage For the Go Extractor
- Add README.md to provide users with project information, usage examples, and contribution guidelines. - Revise CLI usage output for enhanced clarity and readability. Help sections are now categorized, and instructions are more user-friendly.
1 parent 4b45807 commit 2308588

File tree

6 files changed

+166
-590
lines changed

6 files changed

+166
-590
lines changed

language/go/extractor/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Go COREF Data Extractor
2+
3+
This project is a source code implementation of a [COREF](https://github.com/codefuse-ai/CodeFuse-Query?tab=readme-ov-file#code-data-model-coref) data extractor written in Go. It is designed to extract COREF data from A Go project.
4+
5+
## Usage
6+
7+
There are two main ways to use this extractor:
8+
9+
### Method 1: Direct Execution
10+
11+
You can directly run the extractor on the current project by executing:
12+
13+
```shell
14+
go run main.go
15+
```
16+
17+
This will extract the COREF data from the current project.
18+
19+
### Method 2: CLI
20+
21+
Alternatively, you can use the command-line interface (CLI) to extract coreference data. To do so, run the following command:
22+
23+
```shell
24+
go run src/cli/extractor_cli.go src/cli/helper.go -o ./out/coref_go_src.db -ex needmodfile .
25+
```
26+
27+
This will extract the COREF data along with the project's go.mod file and store the extracted data into the `out/coref_go_src.db` file.
28+
29+
30+
## Requirements
31+
32+
This project requires Go 1.18 or higher. Please ensure you have the correct version installed before compiling or running the extractor.
33+
34+
35+
## Installation
36+
37+
```shell
38+
# Clone the repository
39+
git clone https://github.com/codefuse-ai/CodeFuse-Query.git
40+
41+
# Navigate to the Go extractor project directory
42+
cd language/go/extractor
43+
44+
# Build the project
45+
go build -o coref-go-extractor src/cli/extractor_cli.go src/cli/helper.go
46+
47+
```
48+
49+
You can then run the built executable directly:
50+
51+
```shell
52+
./coref-go-extractor -o ./coref_go_src.db .
53+
```
54+
55+
For more detail about the Go extractor, please run
56+
57+
```shell
58+
./coref-go-extractor -h
59+
```
60+
61+
## Contributing
62+
63+
If you would like to contribute to the development of this extractor, please feel free to make a pull request or open an issue to discuss proposed changes.
64+
65+
## License
66+
This project is licensed under the MIT License.

language/go/extractor/go.mod

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,29 @@
11
module alipay.com/code_insight/coref-go-extractor
22

3-
go 1.18
3+
go 1.21.5
44

55
require (
6-
github.com/deckarep/golang-set v1.8.0
7-
github.com/glebarez/sqlite v1.4.5
8-
github.com/stretchr/testify v1.8.0
9-
golang.org/x/mod v0.7.0
10-
golang.org/x/tools v0.4.0
11-
gorm.io/gorm v1.23.5
6+
github.com/glebarez/sqlite v1.10.0
7+
github.com/stretchr/testify v1.9.0
8+
golang.org/x/mod v0.16.0
9+
golang.org/x/tools v0.19.0
10+
gorm.io/gorm v1.25.7
11+
modernc.org/mathutil v1.6.0
1212
)
1313

1414
require (
1515
github.com/davecgh/go-spew v1.1.1 // indirect
16-
github.com/gogo/protobuf v1.3.2 // indirect
17-
github.com/google/gofuzz v1.2.0 // indirect
18-
github.com/json-iterator/go v1.1.12 // indirect
19-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
20-
github.com/modern-go/reflect2 v1.0.2 // indirect
21-
github.com/pmezard/go-difflib v1.0.0 // indirect
22-
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
23-
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
24-
google.golang.org/appengine v1.6.7 // indirect
25-
google.golang.org/protobuf v1.28.1 // indirect
26-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
27-
gopkg.in/inf.v0 v0.9.1 // indirect
28-
gopkg.in/yaml.v3 v3.0.1 // indirect
29-
k8s.io/apimachinery v0.26.2 // indirect
30-
k8s.io/klog/v2 v2.80.1 // indirect
31-
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
32-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
33-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
34-
sigs.k8s.io/yaml v1.3.0 // indirect
35-
)
36-
37-
require (
38-
github.com/glebarez/go-sqlite v1.17.2 // indirect
39-
github.com/go-logr/logr v1.2.3 // indirect
40-
github.com/golang/protobuf v1.5.2 // indirect
16+
github.com/dustin/go-humanize v1.0.1 // indirect
17+
github.com/glebarez/go-sqlite v1.21.2 // indirect
4118
github.com/google/uuid v1.3.0 // indirect
4219
github.com/jinzhu/inflection v1.0.0 // indirect
43-
github.com/jinzhu/now v1.1.4 // indirect
44-
github.com/mattn/go-isatty v0.0.16 // indirect
45-
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
46-
golang.org/x/net v0.7.0 // indirect
47-
golang.org/x/sys v0.5.0 // indirect
48-
golang.org/x/term v0.5.0 // indirect
49-
golang.org/x/text v0.7.0 // indirect
50-
gopkg.in/yaml.v2 v2.4.0 // indirect
51-
k8s.io/client-go v0.26.2
52-
modernc.org/libc v1.16.8 // indirect
53-
modernc.org/mathutil v1.4.1
54-
modernc.org/memory v1.1.1 // indirect
55-
modernc.org/sqlite v1.17.2 // indirect
20+
github.com/jinzhu/now v1.1.5 // indirect
21+
github.com/mattn/go-isatty v0.0.17 // indirect
22+
github.com/pmezard/go-difflib v1.0.0 // indirect
23+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
24+
golang.org/x/sys v0.18.0 // indirect
25+
gopkg.in/yaml.v3 v3.0.1 // indirect
26+
modernc.org/libc v1.22.5 // indirect
27+
modernc.org/memory v1.5.0 // indirect
28+
modernc.org/sqlite v1.23.1 // indirect
5629
)

0 commit comments

Comments
 (0)