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

Maintenance #341

Closed
wants to merge 17 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
36 changes: 36 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on: [push]
jobs:
node-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "10.x"
- run: npm install
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2-beta
with:
go-version: "1.13"
- run: |
GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint
export PATH=$GOPATH/bin:$PATH
golangci-lint run ./...
env:
GOPATH: /tmp/gopath
go-test:
strategy:
matrix:
go: ["1.14", "1.13", "1.12"]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2-beta
with:
go-version: ${{ matrix.go }}
- run: go test -race ./...
# There are no npm tests, yet.
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $(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/jteeuwen/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
Expand All @@ -31,8 +31,11 @@ ui/bindata.go: .build/bin/go-bindata node_modules $(wildcard ui/assets/**/*)
dev: ALL
npm install

test:
go test github.com/hound-search/hound/...
lint:
golangci-lint run ./...

test: lint
go test -race ./...

clean:
rm -rf .build node_modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hound

[![Build Status](https://travis-ci.org/hound-search/hound.svg?branch=master)](https://travis-ci.org/hound-search/hound)
![.github/workflows/go.yaml](https://github.com/spreadshirt/hound/workflows/.github/workflows/go.yaml/badge.svg)

Hound is an extremely fast source code search engine. The core is based on this article (and code) from Russ Cox:
[Regular Expression Matching with a Trigram Index](http://swtch.com/~rsc/regexp/regexp4.html). Hound itself is a static
Expand Down
4 changes: 0 additions & 4 deletions ansi/ansi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ var (
printTests = false
)

func makeReal(s string) string {
return strings.Replace(s, "~", "\x1b", -1)
}

func makeFake(s string) string {
return strings.Replace(s, "\x1b", "~", -1)
}
Expand Down
3 changes: 1 addition & 2 deletions ansi/tty_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package ansi

const ioctlReadTermios = 0x5401 // syscall.TCGETS
const ioctlWriteTermios = 0x5402 // syscall.TCSETS
const ioctlReadTermios = 0x5401 // syscall.TCGETS
2 changes: 1 addition & 1 deletion ansi/tty_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

var (
modkernel32 = syscall.MustLoadDLL("kernel32.dll")
modkernel32 = syscall.MustLoadDLL("kernel32.dll")
procGetConsoleMode = modkernel32.MustFindProc("GetConsoleMode")
)

Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func searchAll(
*filesOpened += r.res.FilesOpened
}

*duration = int(time.Now().Sub(startedAt).Seconds() * 1000)
*duration = int(time.Since(startedAt).Seconds() * 1000)

return res, nil
}
Expand Down
10 changes: 2 additions & 8 deletions client/coalesce.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,9 @@ func matchToBlock(m *index.Match) *Block {

v[b] = true

for _, line := range m.Before {
l = append(l, line)
}

l = append(l, m.Before...)
l = append(l, m.Line)

for _, line := range m.After {
l = append(l, line)
}
l = append(l, m.After...)

return &Block{
Lines: l,
Expand Down
42 changes: 1 addition & 41 deletions cmds/houndd/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package main

import (
"encoding/json"
"flag"
"log"
"net/http"
"os"
"os/exec"
"os/signal"
Expand All @@ -13,10 +11,8 @@ import (
"strings"
"syscall"

"github.com/hound-search/hound/api"
"github.com/hound-search/hound/config"
"github.com/hound-search/hound/searcher"
"github.com/hound-search/hound/ui"
"github.com/hound-search/hound/web"
)

Expand Down Expand Up @@ -45,7 +41,7 @@ func makeSearchers(cfg *config.Config) (map[string]*searcher.Searcher, bool, err
if len(errs) > 0 {
// NOTE: This mutates the original config so the repos
// are not even seen by other code paths.
for name, _ := range errs {
for name := range errs {
delete(cfg.Repos, name)
}

Expand Down Expand Up @@ -77,42 +73,6 @@ func registerShutdownSignal() <-chan os.Signal {
return shutdownCh
}

func makeTemplateData(cfg *config.Config) (interface{}, error) {
var data struct {
ReposAsJson string
}

res := map[string]*config.Repo{}
for name, repo := range cfg.Repos {
res[name] = repo
}

b, err := json.Marshal(res)
if err != nil {
return nil, err
}

data.ReposAsJson = string(b)
return &data, nil
}

func runHttp(
addr string,
dev bool,
cfg *config.Config,
idx map[string]*searcher.Searcher) error {
m := http.DefaultServeMux

h, err := ui.Content(dev, cfg)
if err != nil {
return err
}

m.Handle("/", h)
api.Setup(m, idx)
return http.ListenAndServe(addr, m)
}

func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
info_log = log.New(os.Stdout, "", log.LstdFlags)
Expand Down
Loading