•  


GitHub - abiriadev/goggle: Search your api through types, with speed ??
Skip to content

abiriadev/goggle

Repository files navigation

Goggle ??

Search your api through types, with speed

Overview

Goggle is a type-directed search engine like hoogle but for Go

?? Try Goggle now!

Try Goggle for yourself! You can now visit here to see Goggle in action.

?? Demo

?? Query

You can type query to search and filter results.

The most simplest form is just Go's standard function definition.

func
 length
(
s
 string
) 
int

But we can omit a function name, to retrieve results whose name does not match with length .

func
 (
s
 string
) 
int

We can omit a func keyword too.

(
s
 string
) 
int

Finally, we can omit argument names.

(
string
) 
int

Query syntax definition

Type
 =
 Primitives
 |
 SliceType
 |
 PointerType
 |
 identifier
 .
Primitives
 =
 "
bool
"
 |
 Int
 |
 UInt
 |
 "
float32
"
 |
 "
float64
"
 |
 "
complex64
"
 |
 "
complex128
"
 .
Int
 =
 "
int
"
 |
 "
int8
"
 |
 "
int16
"
 |
 "
int32
"
 |
 "
int64
"
 .
UInt
 =
 "
uint
"
 |
 "
uint8
"
 |
 "
uint16
"
 |
 "
uint32
"
 |
 "
uint64
"
 |
 "
uintptr
"
 .

SliceType
 =
 "
[
"
 "
]
"
 Type
 .

Parameters
 =
 "
(
"
 [ 
Type
 { 
"
,
"
 Type
 } ] 
"
)
"
 .
Query
 =
 [ 
"
func
"
 ] [ 
identifier
 ] 
Parameters
 [ 
Type
 ] .

Build Manually

$ git clone https://github.com/abiriadev/goggle 
&&
 cd
 goggle

Build indexer from source and index custom packages

$ go run ./cmd/indexer
#
 or

$ go run ./cmd/indexer 
<
space separated list of packages to index
>

See help page for more information:

Usage of indexer:
  -f string
        index format (default 
"
gob
"
)
  -o string
        path to save index file

Build and run REPL

$ go run ./cmd/repl
#
 or optionally pass a path to index file to use

$ go run ./cmd/repl 
<
index file to use
>

It will then show you a prompt starting with λ .

Type any query(like () bool ) and enter to see the results.

λ
 () 
bool

func
 utf8
.
FullRune
() 
bool
       // FullRune reports whether the bytes in p begin with a full UTF-8 encoding of a rune.

func
 nettest
.
TestableAddress
() 
bool
     // TestableAddress reports whether address of network is testable on the current platform configuration.

func
 nettest
.
SupportsRawSocket
() 
bool
   // SupportsRawSocket reports whether the current session is available to use raw sockets.

func
 nettest
.
SupportsIPv6
() 
bool
        // SupportsIPv6 reports whether the platform supports IPv6 networking functionality.

func
 nettest
.
SupportsIPv4
() 
bool
        // SupportsIPv4 reports whether the platform supports IPv4 networking functionality.

func
 signal
.
Ignored
() 
bool
      // Ignored reports whether sig is currently ignored.

func
 slices
.
Equal
() 
bool
        // Equal reports whether two slices are equal: the same length and all elements equal.

func
 testenv
.
OptimizationOff
() 
bool
     // OptimizationOff reports whether optimization is disabled.

func
 testenv
.
HasSymlink
() 
bool
  // HasSymlink reports whether the current system can use os.Symlink.

func
 testenv
.
HasSrc
() 
bool
      // HasSrc reports whether the entire source tree is available under GOROOT.

Build and run Goggle server

$ go run ./cmd/goggle

The default port number is 6099 (L33T or Gogg ). You can pass -port option to change it.

Usage of goggle:
  -port int
        port number to 
bind
 (default 6099)

Try requesting from terminal:

$ http :6099/search q=
'
() bool
'
 -v

POST /search HTTP/1.1
Accept: application/json, 
*
/
*
;
q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 15
Content-Type: application/json
Host: localhost:6099
User-Agent: HTTPie/3.2.1

{
    
"
q
"
: 
"
() bool
"

}

HTTP/1.1 200 OK
Access-Control-Allow-Origin: 
*

Content-Length: 1970
Content-Type: text/plain
;
 charset=utf-8
Date: Tue, 12 Dec 2023 04:12:01 GMT

{
    
"
items
"
: [
        {
            
"
sim
"
: 0,
            
"
sig
"
: 
"
func utf8.FullRune() bool
"
,
            
"
summary
"
: 
"
FullRune reports whether the bytes in p begin with a full UTF-8 encoding of a rune.
"
,
            
"
link
"
: 
"
https://pkg.go.dev/unicode/utf8#FullRune
"

        },
        {
            
"
sim
"
: 0,
            
"
sig
"
: 
"
func nettest.TestableAddress() bool
"
,
            
"
summary
"
: 
"
TestableAddress reports whether address of network is testable on the current platform configuration.
"
,
            
"
link
"
: 
"
https://pkg.go.dev/golang.org/x/net/nettest#TestableAddress
"

        },
        ...
    ]
}

Build and run frontend

Ensure that you have Go , Task , Node.js , and Binaryen installed.

Then, execuate the following commands:

$ task wasm-exec syntaxck
$ corepack 
enable

$ pnpm install --frozen-lockfile
$ 
cd
 frontend

If you don't want to have local Goggle proxy, you can specify your already-deployed endpoint by setting VITE_EXTERN_ENDPOINT variable.

$ 
echo
 '
VITE_EXTERN_ENDPOINT=<type your endpoint url here>
'
 >
 .env.production

Then, run!

$ pnpm dev
#
 Or, to use an external endpoint:

$ pnpm dev --mode production

For building the frontend for deployment or serving:

$ pnpm build

?? TODO

  • Index
    • Portable index file
    • Index popular packages
  • Incremental search
  • Frontend
    • Standalone result view
    • Link to pkg.go.dev
    • Brief description
    • Syntax hightlighting for search result
    • Use dedicated search bar component
  • Query
    • Compound types
      • Array
      • Slice
      • Pointer type
      • Inline struct type
      • Interface resolution
    • Method
    • Multiple return
    • Parameter collaping
    • Spread syntax
    • Generics
      • Constraints
  • Levenshtein distance
    • Argument-level similarity comparison
    • Hoogle-like structured edit distance
      • Subtype polymorphic edit distance
  • GHA CD automation
  • External tools
    • REPL
    • vscode extension
    • neovim LSP support?

?? This is really awwwesome!! How can I help?

There are many ways to support and contribute to the ongoing maintenance and improvement of Goggle. Any support is greatly appreciated!

  • Spread the world. Share Goggle with your co-workers, students, and community so that they can find it useful as well!
  • Report bugs. If you encounter any unexpected behavior or runtime panics, please open an issue to report and document them.
  • Make your document cleaner. Although Goggle can find items without documentation, it doesn't have a power to generate intuitive identifiers and descriptive summaries. So it's a good idea to document you package thoroughly to enhance developer experience.
  • Suggest better idea. Currently, Goggle's approximate search doesn't support structural edit-distance, and there are still a lot of missing features. Your suggestions for more accurate and efficient implementations are always welcome.
  • Build creative tools on top of Goggle. Goggle currently supports web search and REPL, but the possibilities for its application are limitless. Ideas like a vscode extension, LSP autocompletion, etc., could significantly expand its ecosystem.
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본