Skip to content

Commit

Permalink
Merge pull request #53 from unidoc/update-unipdf-v3.32.0
Browse files Browse the repository at this point in the history
Prepare v0.5.0 - Update to unipdf v3.32.0 - Add CI
  • Loading branch information
gunnsth committed Feb 7, 2022
2 parents ef8b384 + b1c068a commit 34fced7
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 41 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0
- name: Run golangci-lint
run: |
./bin/golangci-lint run --out-format=github-actions --issues-exit-code=1
build:
name: Build Go ${{ matrix.go }}
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17', '1.16', '1.15', '1.14', '1.13' ]
env:
CGO_ENABLED: 0
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: go vet
run: go vet ./...

- name: Test
run: go test -tags=test -count=1 ./...
53 changes: 53 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
linters:
enable-all: false
enable:
- exportloopref
- staticcheck
- megacheck
- govet
- gosimple
- nakedret
- typecheck
- gosec
- revive
- unconvert
- misspell
disable:
- ineffassign
- errcheck
- varcheck
- deadcode
- unused
- structcheck
- lll
- gofmt
- goconst
- scopelint
run:
concurrency: 4
timeout: 3m
# Keep exit code 0 until we fix all this, i.e. get the baseline set.
issues-exit-code: 0
# Keep this false until we address all the non-test files and set baseline.
tests: true

skip-files:
- ".*_test.go$"

skip-dirs:
- testdata

issues:
exclude-rules:
# We don't control the ciphers as we are just implementing standards.
- linters:
- gosec
text: "weak cryptographic primitive"

# output configuration options
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
path-prefix: ""
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,14 @@ powered by the [UniPDF](https://github.com/unidoc/unipdf-cli) PDF library.

## Installation

Minimum required Go version: 1.11
Minimum required Go version: 1.13. We officially support the 3 latest minor versions of Go, but it may work on earlier ones as well.

```
git clone git@github.com:unidoc/unipdf-cli.git
cd unipdf-cli/cmd/unipdf
go build
```

In Go 1.11 modules are disabled by default in GOPATH/src (`GO111MODULE=auto`).
Newer versions will have Go modules enabled by default. If you choose to clone
the project somewhere in this location, you must explicitly enable Go modules.

```
git clone git@github.com:unidoc/unipdf-cli.git
cd unipdf-cli/cmd/unipdf
export GO111MODULE=on
go build
```

## Showcase

#### Grayscale conversion
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/unidoc/unipdf/v3 v3.30.0
github.com/unidoc/unipdf/v3 v3.32.0
)

go 1.13
22 changes: 11 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand All @@ -20,6 +19,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
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/sirupsen/logrus v1.5.0 h1:1N5EYkVAPEywqZRJd7cwnRtCb6xJx7NH3T3WUTF980Q=
Expand All @@ -33,23 +33,23 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/unidoc/pkcs7 v0.0.0-20200411230602-d883fd70d1df h1:1RV3lxQ6L6xGFNhngpP9iMjJPSwvH3p17JNbK9u5274=
github.com/trimmer-io/go-xmp v1.0.0/go.mod h1:Aaptr9sp1lLv7UnCAdQ+gSHZyY2miYaKmcNVj7HRBwA=
github.com/unidoc/freetype v0.0.0-20220130190903-3efbeefd0c90 h1:Rk4easgDQslR3DK7vwtl6jYMZTF3JqZ3ceUdyT6a3UM=
github.com/unidoc/freetype v0.0.0-20220130190903-3efbeefd0c90/go.mod h1:mJ/Q7JnqEoWtajJVrV6S1InbRv0K/fJerPB5SQs32KI=
github.com/unidoc/pkcs7 v0.0.0-20200411230602-d883fd70d1df/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8=
github.com/unidoc/pkcs7 v0.1.0 h1:9bQfbWMYsIfUP8PyhTcBudOsvbLpNH0MBv4U0P/jDTE=
github.com/unidoc/pkcs7 v0.1.0/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8=
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a h1:RLtvUhe4DsUDl66m7MJ8OqBjq8jpWBXPK6/RKtqeTkc=
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a/go.mod h1:j+qMWZVpZFTvDey3zxUkSgPJZEX33tDgU/QIA0IzCUw=
github.com/unidoc/unipdf/v3 v3.29.0 h1:aM1qO1dFfM5H6BOXdgTbIJBBFxyEDI36cJnCS8JXmRQ=
github.com/unidoc/unipdf/v3 v3.29.0/go.mod h1:WdRz3hVhi/M0jFGXhsT5/9FDyRfga6KgI2ZQqjiOXaM=
github.com/unidoc/unipdf/v3 v3.30.0 h1:P3ziLs2X+wCs4auZHA1AOMOFLo1jhtyZ5wmlH85ZxZ0=
github.com/unidoc/unipdf/v3 v3.30.0/go.mod h1:zyYw8b6bYZneWULBYZIkOi79wgbcMi1AF46jp+6aaiY=
github.com/unidoc/unipdf/v3 v3.32.0 h1:GpQAHDFpQJatXf/iH6ryP1J0GnwPyXhIFuIS219cg1o=
github.com/unidoc/unipdf/v3 v3.32.0/go.mod h1:OUIt+FTxVqRJl3OFuqiPTPaxPwoYUjkmqPiRRh/SfLo=
github.com/unidoc/unitype v0.2.1 h1:x0jMn7pB/tNrjEVjy3Ukpxo++HOBQaTCXcTYFA6BH3w=
github.com/unidoc/unitype v0.2.1/go.mod h1:mafyug7zYmDOusqa7G0dJV45qp4b6TDAN+pHN7ZUIBU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 h1:QelT11PB4FXiDEXucrfNckHoFxwt8USGY1ajP1ZF5lM=
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -58,8 +58,8 @@ golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HX
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/license_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ package cli
import (
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
"github.com/unidoc/unipdf-cli/pkg/pdf"
)

const licenseInfoCmdDesc = `Outputs information about the license key.`

var licenseInfoCmdExample = fmt.Sprintf("%s",
var licenseInfoCmdExample = strings.Join([]string{
fmt.Sprintf("%s license_info", appName),
)
}, "\n")

// licenseInfoCmd represents the license info command.
var licenseInfoCmd = &cobra.Command{
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const appName = "unipdf"
const appVersion = "0.4.0"
const appVersion = "0.5.0"

const rootCmdDesc = ` is a CLI application for working with PDF files.
It supports the most common PDF operations. A full list of the supported
Expand Down Expand Up @@ -55,10 +55,11 @@ func readEnv() {
// Set license key.
licensePath := os.Getenv("UNIDOC_LICENSE_FILE")
licenseCustomer := os.Getenv("UNIDOC_LICENSE_CUSTOMER")

if licensePath != "" {
pdf.SetLicense(licensePath, licenseCustomer)
}

// OR... alternatively... load a License API key.

// Set license key using metered api key.
licenseMeteredKey := os.Getenv("UNIDOC_LICENSE_API_KEY")
Expand Down
1 change: 0 additions & 1 deletion pkg/pdf/pdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func GetMeteredState() {
}
fmt.Printf("Credits: %v\n", state.Credits)
fmt.Printf("Used credits: %v\n", state.Used)
return
}

// SetLogLevel sets the verbosity of the output produced by the Unidoc library.
Expand Down
2 changes: 1 addition & 1 deletion pkg/pdf/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Rotate(inputPath, outputPath string, angle int, password string, pages []in
return "", err
}

rotate, _ := selectedPages[numPage]
rotate := selectedPages[numPage]
if !rotate || angle == 0 {
continue
}
Expand Down

0 comments on commit 34fced7

Please sign in to comment.