Skip to content

Update #1

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
Sep 3, 2022
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
53 changes: 53 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Go

on:
pull_request:
paths-ignore:
- "images/**"
- "**/*.md"
branches:
- main
push:
paths-ignore:
- "images/**"
- "**/*.md"
branches:
- main

jobs:
lint:
name: Run linting
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: "latest"
args: -c ./golangci.yml
- name: Format lint
run: |
make install-tools && make format && git diff --quiet
test:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
go:
[
"1.16.x",
"1.17.x",
"1.18.x",
"1.19.x",
]
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{matrix.go}}
- name: Run Tests
run: make test
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

53 changes: 16 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
.PHONY: all clean clean-coverage install install-dependencies install-tools lint test test-verbose test-with-coverage
.PHONY: install-tools lint test test-verbose format benchmark

export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
export PKG := github.com/sergi/go-diff
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

$(eval $(ARGS):;@:) # turn arguments into do-nothing targets
export ARGS

ifdef ARGS
PKG_TEST := $(ARGS)
else
PKG_TEST := $(PKG)/...
endif

all: install-tools install-dependencies install lint test

clean:
go clean -i $(PKG)/...
go clean -i -race $(PKG)/...
clean-coverage:
find $(ROOT_DIR) | grep .coverprofile | xargs rm
install:
go install -v $(PKG)/...
install-dependencies:
go get -t -v $(PKG)/...
go build -v $(PKG)/...
install-tools:
# Install linting tools
go get -u -v golang.org/x/lint/...
go get -u -v github.com/kisielk/errcheck/...
go install github.com/golangci/golangci-lint/cmd/[email protected]
go install mvdan.cc/gofumpt@latest
go install github.com/segmentio/golines@latest

# Install code coverage tools
go get -u -v github.com/onsi/ginkgo/ginkgo/...
go get -u -v github.com/modocache/gover/...
go get -u -v github.com/mattn/goveralls/...
lint:
$(ROOT_DIR)/scripts/lint.sh
golangci-lint run -c ./golangci.yml ./...

format:
gofumpt -l -w -extra .
golines . -w

test:
go test -race -test.timeout 120s $(PKG_TEST)
go test -race -test.timeout 120s -count=1 ./...

test-verbose:
go test -race -test.timeout 120s -v $(PKG_TEST)
test-with-coverage:
ginkgo -r -cover -race -skipPackage="testdata"
go test -race -test.timeout 120s -v -cover -count=1 ./...

benchmark:
go test -bench=. -benchmem ./...
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# go-diff [![GoDoc](https://godoc.org/github.com/sergi/go-diff?status.png)](https://godoc.org/github.com/sergi/go-diff/diffmatchpatch) [![Build Status](https://travis-ci.org/sergi/go-diff.svg?branch=master)](https://travis-ci.org/sergi/go-diff) [![Coverage Status](https://coveralls.io/repos/sergi/go-diff/badge.png?branch=master)](https://coveralls.io/r/sergi/go-diff?branch=master)
# go-diff [![GoDoc](https://godoc.org/github.com/gkampitakis/go-diff?status.png)](https://godoc.org/github.com/gkampitakis/go-diff/diffmatchpatch)

go-diff offers algorithms to perform operations required for synchronizing plain text:

Expand All @@ -9,7 +9,7 @@ go-diff offers algorithms to perform operations required for synchronizing plain
## Installation

```bash
go get -u github.com/sergi/go-diff/...
go get -u github.com/gkampitakis/go-diff/...
```

## Usage
Expand All @@ -22,7 +22,7 @@ package main
import (
"fmt"

"github.com/sergi/go-diff/diffmatchpatch"
"github.com/gkampitakis/go-diff/diffmatchpatch"
)

const (
Expand All @@ -41,11 +41,11 @@ func main() {

## Found a bug or are you missing a feature in go-diff?

Please make sure to have the latest version of go-diff. If the problem still persists go through the [open issues](https://github.com/sergi/go-diff/issues) in the tracker first. If you cannot find your request just open up a [new issue](https://github.com/sergi/go-diff/issues/new).
Please make sure to have the latest version of go-diff. If the problem still persists go through the [open issues](https://github.com/gkampitakis/go-diff/issues) in the tracker first. If you cannot find your request just open up a [new issue](https://github.com/gkampitakis/go-diff/issues/new).

## How to contribute?

You want to contribute to go-diff? GREAT! If you are here because of a bug you want to fix or a feature you want to add, you can just read on. Otherwise we have a list of [open issues in the tracker](https://github.com/sergi/go-diff/issues). Just choose something you think you can work on and discuss your plans in the issue by commenting on it.
You want to contribute to go-diff? GREAT! If you are here because of a bug you want to fix or a feature you want to add, you can just read on. Otherwise we have a list of [open issues in the tracker](https://github.com/gkampitakis/go-diff/issues). Just choose something you think you can work on and discuss your plans in the issue by commenting on it.

Please make sure that every behavioral change is accompanied by test cases. Additionally, every contribution must pass the `lint` and `test` Makefile targets which can be run using the following commands in the repository root directory.

Expand Down
10 changes: 4 additions & 6 deletions diffmatchpatch/benchutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@

package diffmatchpatch

import (
"io/ioutil"
)
import "os"

const testdataPath = "../testdata/"

func speedtestTexts() (s1 string, s2 string) {
d1, err := ioutil.ReadFile(testdataPath + "speedtest1.txt")
func speedtestTexts() (s1, s2 string) {
d1, err := os.ReadFile(testdataPath + "speedtest1.txt")
if err != nil {
panic(err)
}
d2, err := ioutil.ReadFile(testdataPath + "speedtest2.txt")
d2, err := os.ReadFile(testdataPath + "speedtest2.txt")
if err != nil {
panic(err)
}
Expand Down
Loading