Skip to content

Commit 5a5a6d5

Browse files
committed
docs(readme): add build instructions
1 parent 359187b commit 5a5a6d5

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

README.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,146 @@ Parameters = "(" [ Type { "," Type } ] ")" .
5555
Query = [ "func" ] [ identifier ] Parameters [ Type ] .
5656
```
5757

58+
## Build Manually
59+
60+
```sh
61+
$ git clone https://github.com/abiriadev/goggle && cd goggle
62+
```
63+
64+
### Build indexer from source and index custom packages
65+
66+
```sh
67+
$ go run ./cmd/indexer
68+
# or
69+
$ go run ./cmd/indexer <space separated list of packages to index>
70+
```
71+
72+
See help page for more information:
73+
74+
```sh
75+
Usage of indexer:
76+
-f string
77+
index format (default "gob")
78+
-o string
79+
path to save index file
80+
```
81+
82+
### Build and run REPL
83+
84+
```sh
85+
$ go run ./cmd/repl
86+
# or optionally pass a path to index file to use
87+
$ go run ./cmd/repl <index file to use>
88+
```
89+
90+
It will then show you a prompt starting with `λ`.
91+
92+
Type any query(like `() bool`) and enter to see the results.
93+
94+
```go
95+
λ () bool
96+
func utf8.FullRune() bool // FullRune reports whether the bytes in p begin with a full UTF-8 encoding of a rune.
97+
func nettest.TestableAddress() bool // TestableAddress reports whether address of network is testable on the current platform configuration.
98+
func nettest.SupportsRawSocket() bool // SupportsRawSocket reports whether the current session is available to use raw sockets.
99+
func nettest.SupportsIPv6() bool // SupportsIPv6 reports whether the platform supports IPv6 networking functionality.
100+
func nettest.SupportsIPv4() bool // SupportsIPv4 reports whether the platform supports IPv4 networking functionality.
101+
func signal.Ignored() bool // Ignored reports whether sig is currently ignored.
102+
func slices.Equal() bool // Equal reports whether two slices are equal: the same length and all elements equal.
103+
func testenv.OptimizationOff() bool // OptimizationOff reports whether optimization is disabled.
104+
func testenv.HasSymlink() bool // HasSymlink reports whether the current system can use os.Symlink.
105+
func testenv.HasSrc() bool // HasSrc reports whether the entire source tree is available under GOROOT.
106+
```
107+
108+
### Build and run Goggle server
109+
110+
```sh
111+
$ go run ./cmd/goggle
112+
```
113+
114+
The default port number is `6099`(L33T or `Gogg`). You can pass `-port` option to change it.
115+
116+
```sh
117+
Usage of goggle:
118+
-port int
119+
port number to bind (default 6099)
120+
```
121+
122+
Try requesting from terminal:
123+
124+
```sh
125+
$ http :6099/search q='() bool' -v
126+
127+
POST /search HTTP/1.1
128+
Accept: application/json, */*;q=0.5
129+
Accept-Encoding: gzip, deflate, br
130+
Connection: keep-alive
131+
Content-Length: 15
132+
Content-Type: application/json
133+
Host: localhost:6099
134+
User-Agent: HTTPie/3.2.1
135+
136+
{
137+
"q": "() bool"
138+
}
139+
140+
HTTP/1.1 200 OK
141+
Access-Control-Allow-Origin: *
142+
Content-Length: 1970
143+
Content-Type: text/plain; charset=utf-8
144+
Date: Tue, 12 Dec 2023 04:12:01 GMT
145+
146+
{
147+
"items": [
148+
{
149+
"sim": 0,
150+
"sig": "func utf8.FullRune() bool",
151+
"summary": "FullRune reports whether the bytes in p begin with a full UTF-8 encoding of a rune.",
152+
"link": "https://pkg.go.dev/unicode/utf8#FullRune"
153+
},
154+
{
155+
"sim": 0,
156+
"sig": "func nettest.TestableAddress() bool",
157+
"summary": "TestableAddress reports whether address of network is testable on the current platform configuration.",
158+
"link": "https://pkg.go.dev/golang.org/x/net/nettest#TestableAddress"
159+
},
160+
...
161+
]
162+
}
163+
```
164+
165+
### Build and run frontend
166+
167+
Ensure that you have [Go](https://go.dev), [Task](https://github.com/go-task/task), [Node.js](https://nodejs.org), and [Binaryen](https://github.com/WebAssembly/binaryen) installed.
168+
169+
Then, execuate the following commands:
170+
171+
```sh
172+
$ task wasm-exec syntaxck
173+
$ corepack enable
174+
$ pnpm install --frozen-lockfile
175+
$ cd frontend
176+
```
177+
178+
If you don't want to have local Goggle proxy, you can specify your already-deployed endpoint by setting `VITE_EXTERN_ENDPOINT` variable.
179+
180+
```sh
181+
$ echo 'VITE_EXTERN_ENDPOINT=<type your endpoint url here>' > .env.production
182+
```
183+
184+
Then, run!
185+
186+
```sh
187+
$ pnpm dev
188+
# Or, to use an external endpoint:
189+
$ pnpm dev --mode production
190+
```
191+
192+
For building the frontend for deployment or serving:
193+
194+
```sh
195+
$ pnpm build
196+
```
197+
58198
## :memo: TODO
59199

60200
- [ ] Index

0 commit comments

Comments
 (0)