Skip to content

Commit

Permalink
feat: update repo and dependencies (#1)
Browse files Browse the repository at this point in the history
Release new forked version with no security issue
  • Loading branch information
gkampitakis authored Sep 3, 2022
1 parent 849d7eb commit 46eaa6f
Show file tree
Hide file tree
Showing 18 changed files with 903 additions and 590 deletions.
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

0 comments on commit 46eaa6f

Please sign in to comment.