Skip to content

[feat]Add README and update CLI usage For the Go Extractor #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions language/go/extractor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Go COREF Data Extractor

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.

## Usage

There are two main ways to use this extractor:

### Method 1: Direct Execution

You can directly run the extractor on the current project by executing:

```shell
go run main.go
```

This will extract the COREF data from the current project.

### Method 2: CLI

Alternatively, you can use the command-line interface (CLI) to extract coreference data. To do so, run the following command:

```shell
go run src/cli/extractor_cli.go src/cli/helper.go -o ./out/coref_go_src.db -ex needmodfile .
```

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.


## Requirements

This project requires Go 1.18 or higher. Please ensure you have the correct version installed before compiling or running the extractor.


## Installation

```shell
# Clone the repository
git clone https://github.com/codefuse-ai/CodeFuse-Query.git

# Navigate to the Go extractor project directory
cd language/go/extractor

# Build the project
go build -o coref-go-extractor src/cli/extractor_cli.go src/cli/helper.go

```

You can then run the built executable directly:

```shell
./coref-go-extractor -o ./coref_go_src.db .
```

For more detail about the Go extractor, please run

```shell
./coref-go-extractor -h
```

## Contributing

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.

## License
This project is licensed under the MIT License.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using apache 2.0 license

63 changes: 18 additions & 45 deletions language/go/extractor/go.mod
Original file line number Diff line number Diff line change
@@ -1,56 +1,29 @@
module alipay.com/code_insight/coref-go-extractor

go 1.18
go 1.21.5

require (
github.com/deckarep/golang-set v1.8.0
github.com/glebarez/sqlite v1.4.5
github.com/stretchr/testify v1.8.0
golang.org/x/mod v0.7.0
golang.org/x/tools v0.4.0
gorm.io/gorm v1.23.5
github.com/glebarez/sqlite v1.10.0
github.com/stretchr/testify v1.9.0
golang.org/x/mod v0.16.0
golang.org/x/tools v0.19.0
gorm.io/gorm v1.25.7
modernc.org/mathutil v1.6.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.26.2 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

require (
github.com/glebarez/go-sqlite v1.17.2 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/client-go v0.26.2
modernc.org/libc v1.16.8 // indirect
modernc.org/mathutil v1.4.1
modernc.org/memory v1.1.1 // indirect
modernc.org/sqlite v1.17.2 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/sqlite v1.23.1 // indirect
)
Loading