Skip to content

Commit

Permalink
bindings for enchant v2
Browse files Browse the repository at this point in the history
Fork v1 bindings and target v2 for this repo
  • Loading branch information
danielx committed Jan 30, 2022
1 parent 5092263 commit 383fdf2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM golang:stretch
FROM golang:bullseye

RUN apt-get update && apt-get upgrade -y

RUN apt-get install -y libenchant-dev
RUN apt-get install -y enchant-2 libenchant-2-dev

RUN mkdir /app
WORKDIR /root

ADD . /app/

WORKDIR /app
ADD go.mod /root/
ADD *.go /root/

CMD ["go", "test", "-v", "--cover"]
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.PHONY: test
test:
docker build --rm -t goenchant-test .
docker run --rm -ti goenchant-test
docker build --rm -t goenchant2-test .
docker run --rm -it goenchant2-test

.PHONY: bench
bench:
docker build --rm -t goenchant2-test .
docker run --rm -it goenchant2-test go test --bench=.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# goenchant
# goenchant2

This package provides bindings for the enchant spell checking library.
This package provides bindings for the enchant v2 spell checking library.

See https://github.com/danielx/enchant for bindings for v1

## Prerequisites

You need to have `libenchant` version 1.6 and its development files
You need to have `enchant` version 2 and its development files
installed to use this package. Additionally you need to install the
dictionaries (hunspell, aspell etc.) you would like to use.

### Example
```
sudo apt-get install enchant libenchant-dev hunspell-en
sudo apt-get install enchant-2 libenchant-2-dev hunspell-en-us
```

## Install

```
go get github.com/danielx/enchant
go get github.com/danielx/enchant2
```

## Running tests
Expand All @@ -33,7 +35,7 @@ make test

## Docs

https://godoc.org/github.com/danielx/enchant
https://godoc.org/github.com/danielx/enchant2

## Usage

Expand All @@ -44,7 +46,7 @@ import (
"fmt"
"os"

"github.com/danielx/enchant"
"github.com/danielx/enchant2"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions enchant.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
package enchant

/*
#cgo LDFLAGS: -lenchant
#cgo LDFLAGS: -lenchant-2
#include <stdlib.h>
#include <enchant/enchant.h>
#include <enchant-2/enchant.h>
static char* getString(char **c, int i) {
return c[i];
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/danielx/enchant
module github.com/danielx/enchant2

go 1.15

0 comments on commit 383fdf2

Please sign in to comment.