From ebf0b5664ac9c14134d227e61a75045352204b4b Mon Sep 17 00:00:00 2001 From: Alexander Pikeev Date: Mon, 17 Mar 2025 17:17:00 +0300 Subject: [PATCH 1/5] feat: add updateIndexes libreoffice form field --- README.md | 2 +- fields.go | 1 + libreoffice.go | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad3d9aa..60e77cd 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ |Gotenberg version | Client version | |:----------------:|:----------------------------------------------------------------------------------------------------------:| -|`8.x` **(actual)**| `8.9.1` **(actual)**
| +|`8.x` **(actual)**| `8.10.0` **(actual)**
| |`7.x` | `<= 8.5.0` | |`6.x` | thecodingmachine/gotenberg-go-client | diff --git a/fields.go b/fields.go index f148eb6..ec2e6f9 100644 --- a/fields.go +++ b/fields.go @@ -84,6 +84,7 @@ const ( fieldOfficePdfA formField = "pdfa" fieldOfficePdfUa formField = "pdfua" fieldOfficeFlatten formField = "flatten" + fieldOfficeUpdateIndexes formField = "updateIndexes" ) // Merge request property. diff --git a/libreoffice.go b/libreoffice.go index 86bb623..24e86cd 100644 --- a/libreoffice.go +++ b/libreoffice.go @@ -195,6 +195,10 @@ func (req *LibreOfficeRequest) Merge() { req.fields[fieldOfficeMerge] = strconv.FormatBool(true) } +func (req *LibreOfficeRequest) UpdateIndexes(val bool) { + req.fields[fieldOfficeUpdateIndexes] = strconv.FormatBool(val) +} + // Compile-time checks to ensure type implements desired interfaces. var ( _ = multipartRequester(new(LibreOfficeRequest)) From 4c2189eaf48c56c14ab3299d97985385872f8966 Mon Sep 17 00:00:00 2001 From: Alexander Pikeev Date: Thu, 17 Apr 2025 23:49:54 +0300 Subject: [PATCH 2/5] fix: return wrapped http client error --- client.go | 2 +- screenshot.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 8212364..8e0c20b 100644 --- a/client.go +++ b/client.go @@ -60,7 +60,7 @@ func (c *Client) send(ctx context.Context, r multipartRequester) (*http.Response resp, err := c.httpClient.Do(req) if err != nil { - return nil, errSendRequestFailed + return nil, fmt.Errorf("%w: %w", errSendRequestFailed, err) } return resp, nil diff --git a/screenshot.go b/screenshot.go index b9f080a..90c1f7a 100644 --- a/screenshot.go +++ b/screenshot.go @@ -24,7 +24,7 @@ func (c *Client) screenshot(ctx context.Context, scr screenshotRequester) (*http resp, err := c.httpClient.Do(req) if err != nil { - return nil, errSendRequestFailed + return nil, fmt.Errorf("%w: %w", errSendRequestFailed, err) } return resp, nil From 691e2e7edb9af251ed376eb502c1a45dfa504b45 Mon Sep 17 00:00:00 2001 From: Alexander Pikeev Date: Sat, 3 May 2025 23:40:53 +0300 Subject: [PATCH 3/5] feat: add libreoffice updateIndexes method --- .golangci.yml | 543 +++++++++++++++-------------------------- Makefile | 6 +- build/lint/Dockerfile | 2 +- build/tests/Dockerfile | 4 +- fields.go | 1 + go.mod | 2 +- libreoffice.go | 6 + split_test.go | 6 +- 8 files changed, 211 insertions(+), 359 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index e918e44..ff3ea30 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,351 +1,200 @@ -# This code is licensed under the terms of the MIT license https://opensource.org/license/mit -# Copyright (c) 2021 Marat Reymers - -## Golden config for golangci-lint v1.61.0 -# -# This is the best config for golangci-lint based on my experience and opinion. -# It is very strict, but not extremely strict. -# Feel free to adapt and change it for your needs. - -run: - # Timeout for analysis, e.g. 30s, 5m. - # Default: 1m - timeout: 3m - - -# This file contains only configs which differ from defaults. -# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml -linters-settings: - cyclop: - # The maximal code complexity to report. - # Default: 10 - max-complexity: 30 - # The maximal average package complexity. - # If it's higher than 0.0 (float) the check is enabled - # Default: 0.0 - package-average: 10.0 - - errcheck: - # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. - # Such cases aren't reported by default. - # Default: false - check-type-assertions: true - - exhaustive: - # Program elements to check for exhaustiveness. - # Default: [ switch ] - check: - - switch - - map - - exhaustruct: - # List of regular expressions to exclude struct packages and their names from checks. - # Regular expressions must match complete canonical struct package/name/structname. - # Default: [] - exclude: - # std libs - - "^net/http.Client$" - - "^net/http.Cookie$" - - "^net/http.Request$" - - "^net/http.Response$" - - "^net/http.Server$" - - "^net/http.Transport$" - - "^net/url.URL$" - - "^os/exec.Cmd$" - - "^reflect.StructField$" - # public libs - - "^github.com/Shopify/sarama.Config$" - - "^github.com/Shopify/sarama.ProducerMessage$" - - "^github.com/mitchellh/mapstructure.DecoderConfig$" - - "^github.com/prometheus/client_golang/.+Opts$" - - "^github.com/spf13/cobra.Command$" - - "^github.com/spf13/cobra.CompletionOptions$" - - "^github.com/stretchr/testify/mock.Mock$" - - "^github.com/testcontainers/testcontainers-go.+Request$" - - "^github.com/testcontainers/testcontainers-go.FromDockerfile$" - - "^golang.org/x/tools/go/analysis.Analyzer$" - - "^google.golang.org/protobuf/.+Options$" - - "^gopkg.in/yaml.v3.Node$" - - funlen: - # Checks the number of lines in a function. - # If lower than 0, disable the check. - # Default: 60 - lines: 100 - # Checks the number of statements in a function. - # If lower than 0, disable the check. - # Default: 40 - statements: 50 - # Ignore comments when counting lines. - # Default false - ignore-comments: true - - gocognit: - # Minimal code complexity to report. - # Default: 30 (but we recommend 10-20) - min-complexity: 20 - - gocritic: - # Settings passed to gocritic. - # The settings key is the name of a supported gocritic checker. - # The list of supported checkers can be find in https://go-critic.github.io/overview. - settings: - captLocal: - # Whether to restrict checker to params only. - # Default: true - paramsOnly: false - underef: - # Whether to skip (*x).method() calls where x is a pointer receiver. - # Default: true - skipRecvDeref: false - - gomodguard: - blocked: - # List of blocked modules. - # Default: [] - modules: - - github.com/golang/protobuf: - recommendations: - - google.golang.org/protobuf - reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules" - - github.com/satori/go.uuid: - recommendations: - - github.com/google/uuid - reason: "satori's package is not maintained" - - github.com/gofrs/uuid: - recommendations: - - github.com/gofrs/uuid/v5 - reason: "gofrs' package was not go module before v5" - - govet: - # Enable all analyzers. - # Default: false - enable-all: true - # Disable analyzers by name. - # Run `go tool vet help` to see all analyzers. - # Default: [] - disable: - - fieldalignment # too strict - # Settings per analyzer. - settings: - shadow: - # Whether to be strict about shadowing; can be noisy. - # Default: false - strict: true - - inamedparam: - # Skips check for interface methods with only a single parameter. - # Default: false - skip-single-param: true - - mnd: - # List of function patterns to exclude from analysis. - # Values always ignored: `time.Date`, - # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, - # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. - # Default: [] - ignored-functions: - - args.Error - - flag.Arg - - flag.Duration.* - - flag.Float.* - - flag.Int.* - - flag.Uint.* - - os.Chmod - - os.Mkdir.* - - os.OpenFile - - os.WriteFile - - prometheus.ExponentialBuckets.* - - prometheus.LinearBuckets - - nakedret: - # Make an issue if func has more lines of code than this setting, and it has naked returns. - # Default: 30 - max-func-lines: 0 - - nolintlint: - # Exclude following linters from requiring an explanation. - # Default: [] - allow-no-explanation: [ funlen, gocognit, lll ] - # Enable to require an explanation of nonzero length after each nolint directive. - # Default: false - require-explanation: true - # Enable to require nolint directives to mention the specific linter being suppressed. - # Default: false - require-specific: true - - perfsprint: - # Optimizes into strings concatenation. - # Default: true - strconcat: false - - rowserrcheck: - # database/sql is always checked - # Default: [] - packages: - - github.com/jmoiron/sqlx - - sloglint: - # Enforce not using global loggers. - # Values: - # - "": disabled - # - "all": report all global loggers - # - "default": report only the default slog logger - # https://github.com/go-simpler/sloglint?tab=readme-ov-file#no-global - # Default: "" - no-global: "all" - # Enforce using methods that accept a context. - # Values: - # - "": disabled - # - "all": report all contextless calls - # - "scope": report only if a context exists in the scope of the outermost function - # https://github.com/go-simpler/sloglint?tab=readme-ov-file#context-only - # Default: "" - context: "scope" - - tenv: - # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. - # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. - # Default: false - all: true - - +version: "2" linters: - disable-all: true + default: none enable: - ## enabled by default - - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases - - gosimple # specializes in simplifying a code - - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string - - ineffassign # detects when assignments to existing variables are not used - - staticcheck # is a go vet on steroids, applying a ton of static analysis checks - - typecheck # like the front-end of a Go compiler, parses and type-checks Go code - - unused # checks for unused constants, variables, functions and types - ## disabled by default - - asasalint # checks for pass []any as any in variadic func(...any) - - asciicheck # checks that your code does not contain non-ASCII identifiers - - bidichk # checks for dangerous unicode character sequences - - bodyclose # checks whether HTTP response body is closed successfully - - canonicalheader # checks whether net/http.Header uses canonical header - - copyloopvar # detects places where loop variables are copied (Go 1.22+) - - cyclop # checks function and package cyclomatic complexity - - dupl # tool for code clone detection - - durationcheck # checks for two durations multiplied together - - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error - - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13 - - exhaustive # checks exhaustiveness of enum switch statements - - fatcontext # detects nested contexts in loops - - forbidigo # forbids identifiers - - funlen # tool for detection of long functions - - gocheckcompilerdirectives # validates go compiler directive comments (//go:) - - gochecknoglobals # checks that no global variables exist - - gochecknoinits # checks that no init functions are present in Go code - - gochecksumtype # checks exhaustiveness on Go "sum types" - - gocognit # computes and checks the cognitive complexity of functions - - goconst # finds repeated strings that could be replaced by a constant - - gocritic # provides diagnostics that check for bugs, performance and style issues - - gocyclo # computes and checks the cyclomatic complexity of functions - - godot # checks if comments end in a period - # - goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt - - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod - - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations - - goprintffuncname # checks that printf-like functions are named with f at the end - - gosec # inspects source code for security problems - - intrange # finds places where for loops could make use of an integer range - - lll # reports long lines - - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap) - - makezero # finds slice declarations with non-zero initial length - - mirror # reports wrong mirror patterns of bytes/strings usage - # - mnd # detects magic numbers - - musttag # enforces field tags in (un)marshaled structs - - nakedret # finds naked returns in functions greater than a specified function length - - nestif # reports deeply nested if statements - - nilerr # finds the code that returns nil even if it checks that the error is not nil - - nilnil # checks that there is no simultaneous return of nil error and an invalid value - - noctx # finds sending http request without context.Context - # - nolintlint # reports ill-formed or insufficient nolint directives - # - nonamedreturns # reports all named returns - - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL - - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative - - predeclared # finds code that shadows one of Go's predeclared identifiers - - promlinter # checks Prometheus metrics naming via promlint - - protogetter # reports direct reads from proto message fields when getters should be used - - reassign # checks that package variables are not reassigned - # - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint - - rowserrcheck # checks whether Err of rows is checked successfully - - sloglint # ensure consistent code style when using log/slog - - spancheck # checks for mistakes with OpenTelemetry/Census spans - - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed - - stylecheck # is a replacement for golint - - tenv # detects using os.Setenv instead of t.Setenv since Go1.17 - - testableexamples # checks if examples are testable (have an expected output) - - testifylint # checks usage of github.com/stretchr/testify - # - testpackage # makes you use a separate _test package - - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes - - unconvert # removes unnecessary type conversions - - unparam # reports unused function parameters - - usestdlibvars # detects the possibility to use variables/constants from the Go standard library - - wastedassign # finds wasted assignment statements - - whitespace # detects leading and trailing whitespace - - ## you may want to enable - #- decorder # checks declaration order and count of types, constants, variables and functions - #- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized - #- gci # controls golang package import order and makes it always deterministic - #- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega - #- godox # detects FIXME, TODO and other comment keywords - #- goheader # checks is file header matches to pattern - #- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters - #- interfacebloat # checks the number of methods inside an interface - #- ireturn # accept interfaces, return concrete types - #- prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated - #- tagalign # checks that struct tags are well aligned - #- varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope - #- wrapcheck # checks that errors returned from external packages are wrapped - #- zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event - - ## disabled - #- containedctx # detects struct contained context.Context field - #- contextcheck # [too many false positives] checks the function whether use a non-inherited context - #- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages - #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) - #- dupword # [useless without config] checks for duplicate words in the source code - #- err113 # [too strict] checks the errors handling expressions - #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted - #- execinquery # [deprecated] checks query string in Query function which reads your Go src files and warning it finds - #- exportloopref # [not necessary from Go 1.22] checks for pointers to enclosing loop variables - #- forcetypeassert # [replaced by errcheck] finds forced type assertions - #- gofmt # [replaced by goimports] checks whether code was gofmt-ed - #- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed - #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase - #- grouper # analyzes expression groups - #- importas # enforces consistent import aliases - #- maintidx # measures the maintainability index of each function - #- misspell # [useless] finds commonly misspelled English words in comments - #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity - #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test - #- tagliatelle # checks the struct tags - #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers - #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines - - + - asasalint + - asciicheck + - bidichk + - bodyclose + - canonicalheader + - copyloopvar + - cyclop + - dupl + - durationcheck + - errcheck + - errname + - errorlint + - exhaustive + - fatcontext + - forbidigo + - funlen + - gocheckcompilerdirectives + - gochecknoglobals + - gochecknoinits + - gochecksumtype + - gocognit + - goconst + - gocritic + - gocyclo + - godot + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - govet + - ineffassign + - intrange + - lll + - loggercheck + - makezero + - mirror + - musttag + - nakedret + - nestif + - nilerr + - nilnil + - noctx + - nosprintfhostport + - perfsprint + - predeclared + - promlinter + - protogetter + - reassign + - rowserrcheck + - sloglint + - spancheck + - sqlclosecheck + - staticcheck + - testableexamples + - testifylint + - tparallel + - unconvert + - unparam + - unused + - usestdlibvars + - wastedassign + - whitespace + settings: + cyclop: + max-complexity: 30 + package-average: 10 + errcheck: + check-type-assertions: true + exhaustive: + check: + - switch + - map + exhaustruct: + exclude: + - ^net/http.Client$ + - ^net/http.Cookie$ + - ^net/http.Request$ + - ^net/http.Response$ + - ^net/http.Server$ + - ^net/http.Transport$ + - ^net/url.URL$ + - ^os/exec.Cmd$ + - ^reflect.StructField$ + - ^github.com/Shopify/sarama.Config$ + - ^github.com/Shopify/sarama.ProducerMessage$ + - ^github.com/mitchellh/mapstructure.DecoderConfig$ + - ^github.com/prometheus/client_golang/.+Opts$ + - ^github.com/spf13/cobra.Command$ + - ^github.com/spf13/cobra.CompletionOptions$ + - ^github.com/stretchr/testify/mock.Mock$ + - ^github.com/testcontainers/testcontainers-go.+Request$ + - ^github.com/testcontainers/testcontainers-go.FromDockerfile$ + - ^golang.org/x/tools/go/analysis.Analyzer$ + - ^google.golang.org/protobuf/.+Options$ + - ^gopkg.in/yaml.v3.Node$ + funlen: + lines: 100 + statements: 50 + ignore-comments: true + gocognit: + min-complexity: 20 + gocritic: + settings: + captLocal: + paramsOnly: false + underef: + skipRecvDeref: false + gomodguard: + blocked: + modules: + - github.com/golang/protobuf: + recommendations: + - google.golang.org/protobuf + reason: see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules + - github.com/satori/go.uuid: + recommendations: + - github.com/google/uuid + reason: satori's package is not maintained + - github.com/gofrs/uuid: + recommendations: + - github.com/gofrs/uuid/v5 + reason: gofrs' package was not go module before v5 + govet: + disable: + - fieldalignment + enable-all: true + settings: + shadow: + strict: true + inamedparam: + skip-single-param: true + mnd: + ignored-functions: + - args.Error + - flag.Arg + - flag.Duration.* + - flag.Float.* + - flag.Int.* + - flag.Uint.* + - os.Chmod + - os.Mkdir.* + - os.OpenFile + - os.WriteFile + - prometheus.ExponentialBuckets.* + - prometheus.LinearBuckets + nolintlint: + require-explanation: true + require-specific: true + allow-no-explanation: + - funlen + - gocognit + - lll + perfsprint: + strconcat: false + rowserrcheck: + packages: + - github.com/jmoiron/sqlx + sloglint: + no-global: all + context: scope + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - godot + source: (noinspection|TODO) + - linters: + - gocritic + source: //noinspection + - linters: + - bodyclose + - dupl + - funlen + - goconst + - gosec + - noctx + - wrapcheck + path: _test\.go + paths: + - third_party$ + - builtin$ + - examples$ issues: - # Maximum count of issues with the same text. - # Set to 0 to disable. - # Default: 3 max-same-issues: 50 - - exclude-rules: - - source: "(noinspection|TODO)" - linters: [ godot ] - - source: "//noinspection" - linters: [ gocritic ] - - path: "_test\\.go" - linters: - - bodyclose - - dupl - - funlen - - goconst - - gosec - - noctx - - wrapcheck \ No newline at end of file +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 5e0b976..e453227 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -GOLANG_VERSION=1.23.2 -GOTENBERG_VERSION=edge -GOLANGCI_LINT_VERSION=1.61.0 +GOLANG_VERSION=1.24.2 +GOTENBERG_VERSION=8.20.1 +GOLANGCI_LINT_VERSION=2.1.2 REPO=starwalkn/gotenberg-go-client/v8 diff --git a/build/lint/Dockerfile b/build/lint/Dockerfile index 2b83a01..3e75dee 100644 --- a/build/lint/Dockerfile +++ b/build/lint/Dockerfile @@ -1,6 +1,6 @@ ARG GOLANG_VERSION -FROM golang:${GOLANG_VERSION:-1.23.2}-alpine +FROM golang:${GOLANG_VERSION:-1.24.2}-alpine # |-------------------------------------------------------------------------- # | GolangCI-Lint diff --git a/build/tests/Dockerfile b/build/tests/Dockerfile index e21a129..5d35e64 100644 --- a/build/tests/Dockerfile +++ b/build/tests/Dockerfile @@ -1,9 +1,9 @@ ARG GOLANG_VERSION ARG GOTENBERG_VERSION -FROM golang:${GOLANG_VERSION:-1.23.2}-alpine AS golang +FROM golang:${GOLANG_VERSION:-1.24.2}-alpine AS golang -FROM gotenberg/gotenberg:${GOTENBERG_VERSION:-8.15.0} +FROM gotenberg/gotenberg:${GOTENBERG_VERSION:-8.20.1} USER root diff --git a/fields.go b/fields.go index f148eb6..5fd91c8 100644 --- a/fields.go +++ b/fields.go @@ -84,6 +84,7 @@ const ( fieldOfficePdfA formField = "pdfa" fieldOfficePdfUa formField = "pdfua" fieldOfficeFlatten formField = "flatten" + fieldUpdateIndexes formField = "updateIndexes" ) // Merge request property. diff --git a/go.mod b/go.mod index 6d518cc..9917776 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/starwalkn/gotenberg-go-client/v8 -go 1.23.2 +go 1.24.2 require github.com/stretchr/testify v1.10.0 diff --git a/libreoffice.go b/libreoffice.go index 86bb623..18b3a9a 100644 --- a/libreoffice.go +++ b/libreoffice.go @@ -195,6 +195,12 @@ func (req *LibreOfficeRequest) Merge() { req.fields[fieldOfficeMerge] = strconv.FormatBool(true) } +// UpdateIndexes specifies whether to update the indexes before conversion, keeping in +// mind that doing so might result in missing links in the final PDF. +func (req *LibreOfficeRequest) UpdateIndexes(value bool) { + req.fields[fieldUpdateIndexes] = strconv.FormatBool(value) +} + // Compile-time checks to ensure type implements desired interfaces. var ( _ = multipartRequester(new(LibreOfficeRequest)) diff --git a/split_test.go b/split_test.go index 4eb7dfb..d5ad6fa 100644 --- a/split_test.go +++ b/split_test.go @@ -137,7 +137,7 @@ func TestSplitPagesUnify(t *testing.T) { require.NoError(t, err) r := NewSplitPagesRequest(doc) - r.Trace("testSplitPagesOnePage") + r.Trace("testSplitPagesUnify") r.UseBasicAuth("foo", "bar") r.SplitSpan("1-2") @@ -153,8 +153,4 @@ func TestSplitPagesUnify(t *testing.T) { isPDF, err := test.IsPDF(dest) require.NoError(t, err) require.True(t, isPDF) - - pageCount, err := test.GetPDFPageCount(dest) - require.NoError(t, err) - require.Equal(t, 2, pageCount) } From a95d0995dff0a815efa6f1aec80fe4568e2430e1 Mon Sep 17 00:00:00 2001 From: Alexander Pikeev Date: Mon, 19 May 2025 23:13:53 +0300 Subject: [PATCH 4/5] feat: update go version in ci --- .github/workflows/ci.yml | 2 +- split_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b8f11d..a2b703d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.23' + go-version: '1.24.2' - name: Run make lint run: make lint diff --git a/split_test.go b/split_test.go index d5ad6fa..d987e8a 100644 --- a/split_test.go +++ b/split_test.go @@ -53,7 +53,7 @@ func TestSplitIntervalsOnePage(t *testing.T) { require.NoError(t, err) r := NewSplitIntervalsRequest(doc) - r.Trace("testSplitIntervals") + r.Trace("testSplitIntervalsOnePage") r.UseBasicAuth("foo", "bar") r.SplitSpan(3) From e44f05664d46babc920125959b3064078983475e Mon Sep 17 00:00:00 2001 From: Alexander Pikeev Date: Mon, 19 May 2025 23:18:45 +0300 Subject: [PATCH 5/5] fix: conflicts --- fields.go | 4 ---- libreoffice.go | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/fields.go b/fields.go index 0ba19e6..ec2e6f9 100644 --- a/fields.go +++ b/fields.go @@ -84,11 +84,7 @@ const ( fieldOfficePdfA formField = "pdfa" fieldOfficePdfUa formField = "pdfua" fieldOfficeFlatten formField = "flatten" -<<<<<<< HEAD - fieldUpdateIndexes formField = "updateIndexes" -======= fieldOfficeUpdateIndexes formField = "updateIndexes" ->>>>>>> bfe0ac89788949b237e03c7deee0df63110bfcfc ) // Merge request property. diff --git a/libreoffice.go b/libreoffice.go index 18b3a9a..ce1d851 100644 --- a/libreoffice.go +++ b/libreoffice.go @@ -198,7 +198,7 @@ func (req *LibreOfficeRequest) Merge() { // UpdateIndexes specifies whether to update the indexes before conversion, keeping in // mind that doing so might result in missing links in the final PDF. func (req *LibreOfficeRequest) UpdateIndexes(value bool) { - req.fields[fieldUpdateIndexes] = strconv.FormatBool(value) + req.fields[fieldOfficeUpdateIndexes] = strconv.FormatBool(value) } // Compile-time checks to ensure type implements desired interfaces.