Skip to content
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

Replace go-bindata with //go:embed and upgrade to go 1.18 #430

Closed
wants to merge 7 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
on: [push]
on: [push, pull_request]
jobs:
go-build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.18", "1.17", "1.14"]
go: ["1.18", "1.17"]
steps:
- uses: actions/[email protected]
- uses: actions/setup-go@v2
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
go-test:
strategy:
matrix:
go: ["1.18", "1.17", "1.14"]
go: ["1.18", "1.17"]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.vagrant
/.build
/ui/.build
/node_modules
.DS_Store
*.exe
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.11.7
FROM alpine:3.16

ENV GOPATH /go

COPY . /go/src/github.com/hound-search/hound

RUN apk update \
&& apk add go git subversion libc-dev mercurial bzr openssh tini \
&& apk add go git subversion libc-dev mercurial breezy openssh tini \
&& cd /go/src/github.com/hound-search/hound \
&& go mod download \
&& go install github.com/hound-search/hound/cmds/houndd \
Expand Down
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@ endif

ALL: $(CMDS)

ui: ui/bindata.go
ui: ui/.build/ui

node_modules:
npm install

$(GOPATH)/bin/houndd: ui/bindata.go $(SRCS)
$(GOPATH)/bin/houndd: ui/.build/ui $(SRCS)
go install github.com/hound-search/hound/cmds/houndd

$(GOPATH)/bin/hound: ui/bindata.go $(SRCS)
go install github.com/hound-search/hound/cmds/hound

.build/bin/go-bindata:
GOPATH=`pwd`/.build go get github.com/go-bindata/go-bindata/...

ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
rsync -r ui/assets/* .build/ui
ui/.build/ui: node_modules $(wildcard ui/assets/**/*)
mkdir -p ui/.build
rsync -r ui/assets/* ui/.build/ui
npx webpack $(WEBPACK_ARGS)
$< -o $@ -pkg ui -prefix .build/ui -nomemcopy .build/ui/...

dev: ALL
npm install
Expand All @@ -43,4 +40,4 @@ lint:
golangci-lint run ./...

clean:
rm -rf .build node_modules
rm -rf ui/.build node_modules
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Hound is an extremely fast source code search engine. The core is based on this
### Using Go Tools


0. [Install Go](https://golang.org/doc/install) if you don't have it already. Hound requires version 1.4 or later.
You might also want to define a [`GOPATH`](https://github.com/golang/go/wiki/GOPATH) environment variable)
(it defaults to $HOME/go if you don't explicitly have one set). If everything is installed properly, `go version` should
print out the installed version of go.
0. [Install Go](https://golang.org/doc/install) if you don't have it already. Hound requires version 1.18 or later.
You might also want to define a [`GOPATH`](https://github.com/golang/go/wiki/GOPATH) environment variable)
(it defaults to $HOME/go if you don't explicitly have one set). If everything is installed properly, `go version` should
print out the installed version of go.

1. Use the Go tools to install Hound. The binaries `houndd` (server) and `hound` (cli) will be installed in your $GOPATH/bin directory. Your $GOPATH should be in your $PATH (`echo $PATH` to check).

Expand All @@ -26,8 +26,8 @@ print out the installed version of go.
go get github.com/hound-search/hound/cmds/...
```

2. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json)
to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using
2. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json)
to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using
the config found in [default-config.json](default-config.json):

```json
Expand All @@ -40,7 +40,7 @@ the config found in [default-config.json](default-config.json):
```


A complete list of available config options can be found [here](docs/config-options.md).
A complete list of available config options can be found [here](docs/config-options.md).
3. Run the Hound server with `houndd` in the same directory as your `config.json`. You should see output similar to:
```
2015/03/13 09:07:42 Searcher started for statsd
Expand All @@ -51,24 +51,24 @@ A complete list of available config options can be found [here](docs/config-opti

4. By default, hound hosts a web ui at http://localhost:6080 . Open it in your browser, and start searching.

### Using Docker (1.4+)
### Using Docker (1.14+)

0. [Install docker](https://docs.docker.com/get-docker/) if you don't have it. We need at least `Docker >= 1.14`.

1. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json)
to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using
the config found in [default-config.json](default-config.json).
1. Create a config.json file and use it to list your repositories. Check out our [example-config.json](config-example.json)
to see how to set up various types of repositories. For example, we can configure Hound to search its own source code using
the config found in [default-config.json](default-config.json).

2. Run
```
docker run -d -p 6080:6080 --name hound -v $(pwd):/data ghcr.io/hound-search/hound:latest
```

You should be able to navigate to [http://localhost:6080/](http://localhost:6080/) as usual.
You should be able to navigate to [http://localhost:6080/](http://localhost:6080/) as usual.

## Running in Production

There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds.
There are no special flags to run Hound in production. You can use the `--addr=:6880` flag to control the port to which the server binds.
Currently, Hound does not support TLS as most users simply run Hound behind either Apache or nginx. However, we are open to contributions to add TLS support.

## Why Another Code Search Tool?
Expand All @@ -77,7 +77,7 @@ We've used many similar tools in the past, and most of them are either too slow,
Which brings us to...

## Requirements
* Go 1.13+
* Go 1.18+

Yup, that's it. You can proxy requests to the Go service through Apache/nginx/etc., but that's not required.

Expand All @@ -86,7 +86,7 @@ Yup, that's it. You can proxy requests to the Go service through Apache/nginx/et

Currently Hound is only tested on MacOS and CentOS, but it should work on any *nix system. Hound on Windows is not supported but we've heard it compiles and runs just fine (although it helps to to exclude your data folder from Windows Search Indexer).

Hound supports the following version control systems:
Hound supports the following version control systems:

* Git - This is the default
* Mercurial - use `"vcs" : "hg"` in the config
Expand All @@ -101,12 +101,12 @@ There are a couple of ways to get Hound to index private repositories:

* Use the `file://` protocol. This allows you to index a local clone of a repository. The downside here is that the polling to keep the repo up to date will
not work. (This also doesn't work on local folders that are not of a supported repository type.) If you're using Docker, you must mount a volume to your repository (e.g., `-v $(pwd)/src:/src`) and use the relative path to the repo in your configuration.
* Use SSH style URLs in the config: `"url" : "[email protected]:foo/bar.git"`. As long as you have your
* Use SSH style URLs in the config: `"url" : "[email protected]:foo/bar.git"`. As long as you have your
[SSH keys](https://help.github.com/articles/generating-ssh-keys/) set up on the box where Hound is running this will work.

## Keeping Repos Updated

By default Hound polls the URL in the config for updates every 30 seconds. You can override this value by setting the `ms-between-poll` key on a per repo basis in the config. If you are indexing a large number of repositories, you may also be interested in tweaking the `max-concurrent-indexers` property. You can see how these work in the [example config](config-example.json).
By default Hound polls the URL in the config for updates every 30 seconds. You can override this value by setting the `ms-between-poll` key on a per repo basis in the config. If you are indexing a large number of repositories, you may also be interested in tweaking the `max-concurrent-indexers` property. You can see how these work in the [example config](config-example.json).

## Editor Integration

Expand Down Expand Up @@ -155,8 +155,8 @@ If you want to just run the JavaScript test suite, use:
npm test
```

Any Go files that end in `_test.go` are assumed to be test files. Similarly, any JavaScript files that ends in `.test.js` are automatically run by Jest, our test runner. Tests should live next to the files that they cover.
[Check out Jest's docs](https://jestjs.io/docs/en/getting-started) for more details on writing Jest tests,
Any Go files that end in `_test.go` are assumed to be test files. Similarly, any JavaScript files that ends in `.test.js` are automatically run by Jest, our test runner. Tests should live next to the files that they cover.
[Check out Jest's docs](https://jestjs.io/docs/en/getting-started) for more details on writing Jest tests,
and [check out Go's testing docs](https://golang.org/pkg/testing/) for more details on testing Go code.

You need to install `Node.js >= 12` and install `jest` by `npm install jest` to run the JS tests.
Expand Down
2 changes: 1 addition & 1 deletion cmds/houndd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"strings"
"syscall"

"github.com/blang/semver"
"github.com/blang/semver/v4"
"github.com/hound-search/hound/api"
"github.com/hound-search/hound/config"
"github.com/hound-search/hound/searcher"
Expand Down
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module github.com/hound-search/hound

go 1.13
go 1.17

require (
github.com/blang/semver v3.5.1+incompatible
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
)
require github.com/blang/semver/v4 v4.0.0
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
github.com/blang/semver v1.1.0 h1:ol1rO7QQB5uy7umSNV7VAmLugfLRD+17sYJujRNYPhg=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/go-bindata/go-bindata v1.0.0 h1:DZ34txDXWn1DyWa+vQf7V9ANc2ILTtrEjtlsdJRF26M=
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
Loading