Skip to content

Commit

Permalink
8.7.4 (#30)
Browse files Browse the repository at this point in the history
* chore: use testing TempDir method instead of creating from random string with os package

* chore: update dependencies

* chore: delete code of conduct, contributing, issue and pull request templates

* chore: change go module name

* chore: use gofumpt insteaf of go fmt on make fmt command

* chore: multipart and screenshot requester interfaces are now unexported

* chore: rename office to libreoffice

* chore: move gotenberg endpoints to constants

* chore: update versions table

* chore: update module name in README

---------

Co-authored-by: Alexander Pikeev <[email protected]>
  • Loading branch information
starwalkn and Alexander Pikeev authored Dec 21, 2024
1 parent 3b726ff commit 1e88bd7
Show file tree
Hide file tree
Showing 28 changed files with 146 additions and 142 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ GOLANG_VERSION=1.23.2
GOTENBERG_VERSION=8.14.1
GOLANGCI_LINT_VERSION=1.61.0

REPO=runatal/gotenberg-go-client/v8
REPO=starwalkn/gotenberg-go-client/v8

# gofmt and goimports all go files.
# gofumpt and goimports all go files.
fmt:
go fmt ./...
gofumpt -l -w .
go mod tidy

# run linters.
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

|Gotenberg version | Client version |
|:----------------:|:----------------------------------------------------------------------------------------------------------:|
|`8.x` **(actual)**| `8.7.3` **(actual)** <br/> |
|`8.x` **(actual)**| `8.7.4` **(actual)** <br/> |
|`7.x` | `<= 8.5.0` |
|`6.x` | <a href="https://github.com/thecodingmachine/gotenberg-go-client">thecodingmachine/gotenberg-go-client</a> |

Expand All @@ -18,7 +18,7 @@
To get the latest version of the client:

```zsh
$ go get github.com/runatal/gotenberg-go-client/v8@latest
$ go get github.com/starwalkn/gotenberg-go-client/v8@latest
```

## Preparing a documents
Expand All @@ -30,8 +30,8 @@ import (
"net/http"
"os"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -65,8 +65,8 @@ import (
"context"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -121,8 +121,8 @@ import (
"encoding/json"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -160,8 +160,8 @@ import (
"encoding/json"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down Expand Up @@ -198,8 +198,8 @@ import (
"context"
"net/http"

"github.com/runatal/gotenberg-go-client/v8"
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion baserequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"net/http"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

type baseRequester interface {
Expand Down
2 changes: 1 addition & 1 deletion build/lint/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GOLANG_VERSION

FROM golang:${GOLANG_VERSION}-alpine
FROM golang:${GOLANG_VERSION:-1.23.2}-alpine

# |--------------------------------------------------------------------------
# | GolangCI-Lint
Expand Down
8 changes: 4 additions & 4 deletions build/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG GOLANG_VERSION
ARG GOTENBERG_VERSION

FROM golang:${GOLANG_VERSION}-alpine AS golang
FROM golang:${GOLANG_VERSION:-1.23.2}-alpine AS golang

FROM gotenberg/gotenberg:${GOTENBERG_VERSION}
FROM gotenberg/gotenberg:${GOTENBERG_VERSION:-8.14.1}

USER root

Expand All @@ -29,8 +29,8 @@ COPY --from=golang /usr/local/go /usr/local/go
RUN export PATH="/usr/local/go/bin:$PATH" &&\
go version

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

# |--------------------------------------------------------------------------
# | Final touch
Expand Down
2 changes: 1 addition & 1 deletion chromium.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"time"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

type chromiumRequest struct {
Expand Down
18 changes: 9 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var (
errSendRequestFailed = errors.New("request sending failed")
)

// MultipartRequester is a type for sending form fields and form files (documents) to the Gotenberg API.
type MultipartRequester interface {
// multipartRequester is a type for sending form fields and form files (documents) to the Gotenberg API.
type multipartRequester interface {
endpoint() string

baseRequester
Expand Down Expand Up @@ -48,11 +48,11 @@ func NewClient(hostname string, httpClient *http.Client) (*Client, error) {
}

// Send sends a request to the Gotenberg API and returns the response.
func (c *Client) Send(ctx context.Context, req MultipartRequester) (*http.Response, error) {
func (c *Client) Send(ctx context.Context, req multipartRequester) (*http.Response, error) {
return c.send(ctx, req)
}

func (c *Client) send(ctx context.Context, r MultipartRequester) (*http.Response, error) {
func (c *Client) send(ctx context.Context, r multipartRequester) (*http.Response, error) {
req, err := c.createRequest(ctx, r, r.endpoint())
if err != nil {
return nil, err
Expand All @@ -67,11 +67,11 @@ func (c *Client) send(ctx context.Context, r MultipartRequester) (*http.Response
}

// Store creates the resulting file to given destination.
func (c *Client) Store(ctx context.Context, req MultipartRequester, dest string) error {
func (c *Client) Store(ctx context.Context, req multipartRequester, dest string) error {
return c.store(ctx, req, dest)
}

func (c *Client) store(ctx context.Context, req MultipartRequester, dest string) error {
func (c *Client) store(ctx context.Context, req multipartRequester, dest string) error {
if hasWebhook(req) {
return errWebhookNotAllowed
}
Expand Down Expand Up @@ -117,8 +117,8 @@ func writeNewFile(fpath string, in io.Reader) error {
return nil
}

func (c *Client) createRequest(ctx context.Context, br baseRequester, endpoint string) (*http.Request, error) {
body, contentType, err := multipartForm(br)
func (c *Client) createRequest(ctx context.Context, mr multipartRequester, endpoint string) (*http.Request, error) {
body, contentType, err := multipartForm(mr)
if err != nil {
return nil, err
}
Expand All @@ -131,7 +131,7 @@ func (c *Client) createRequest(ctx context.Context, br baseRequester, endpoint s
}

req.Header.Set("Content-Type", contentType)
for key, value := range br.customHeaders() {
for key, value := range mr.customHeaders() {
req.Header.Set(string(key), value)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/runatal/gotenberg-go-client/v8
module github.com/starwalkn/gotenberg-go-client/v8

go 1.23.2

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
4 changes: 2 additions & 2 deletions html.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gotenberg

import (
"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/document"
)

const (
Expand Down Expand Up @@ -54,5 +54,5 @@ func (req *HTMLRequest) Assets(assets ...document.Document) {

// Compile-time checks to ensure type implements desired interfaces.
var (
_ = MultipartRequester(new(HTMLRequest))
_ = multipartRequester(new(HTMLRequest))
)
4 changes: 2 additions & 2 deletions html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/runatal/gotenberg-go-client/v8/document"
"github.com/runatal/gotenberg-go-client/v8/test"
"github.com/starwalkn/gotenberg-go-client/v8/document"
"github.com/starwalkn/gotenberg-go-client/v8/test"
)

func TestHTML(t *testing.T) {
Expand Down
Loading

0 comments on commit 1e88bd7

Please sign in to comment.