Skip to content

Commit

Permalink
feat: disable var-naming linter & fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Pikeev committed Oct 21, 2024
1 parent 3c9ce0a commit 6b9116e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/lint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ COPY go.sum .
# Install module dependencies.
RUN go mod download

CMD [ "golangci-lint", "run" ,"--tests=false", "--enable-all", "--disable=dupl", "--disable=wsl", "--disable=nolintlint" ]
CMD [ "golangci-lint", "run" ,"--tests=false", "--enable-all", "--disable=dupl", "--disable=wsl", "--disable=nolintlint", "--disable=var-naming" ]
4 changes: 2 additions & 2 deletions chrome.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
formFieldScale string = "scale"
formFieldSkipNetworkIdleEvent string = "skipNetworkIdleEvent"
formFieldSinglePage string = "singlePage"
formFieldPreferCssPageSize string = "preferCssPageSize"
formFieldPreferCSSPageSize string = "preferCssPageSize"
formFieldPrintBackground string = "printBackground"
formFieldOmitBackground string = "omitBackground"
formFieldFormat string = "format"
Expand Down Expand Up @@ -233,7 +233,7 @@ func (req *chromeRequest) SinglePage() {

// Prefer page size as defined by CSS.
func (req *chromeRequest) PreferCssPageSize() {
req.values[formFieldPreferCssPageSize] = strconv.FormatBool(true)
req.values[formFieldPreferCSSPageSize] = strconv.FormatBool(true)
}

// Print the background graphics.
Expand Down
9 changes: 7 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import (
"strconv"
)

var (
errWebhookNotAllowed = errors.New("cannot use Store method with a webhook")
errGenerationFailed = errors.New("failed to generate the result PDF")
)

const (
resultFilename string = "resultFilename"
waitTimeout string = "waitTimeout"
Expand Down Expand Up @@ -139,7 +144,7 @@ func (c *Client) Store(req Request, dest string) error {
// The created HTTP request can be canceled by the passed context.
func (c *Client) StoreContext(ctx context.Context, req Request, dest string) error {
if hasWebhook(req) {
return errors.New("cannot use Store method with a webhook")
return errWebhookNotAllowed
}

resp, err := c.PostContext(ctx, req)
Expand All @@ -149,7 +154,7 @@ func (c *Client) StoreContext(ctx context.Context, req Request, dest string) err
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return errors.New("failed to generate the result PDF" + resp.Status)
return fmt.Errorf("%w: %s", errGenerationFailed, resp.Status)
}
return writeNewFile(dest, resp.Body)
}
Expand Down
4 changes: 2 additions & 2 deletions office.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
type PdfAFormat string

const (
// Deprecated: Beginning with version 7.6, LibreOffice has discontinued support for PDF/A-1a
// Deprecated: Beginning with version 7.6, LibreOffice has discontinued support for PDF/A-1a.
PdfA1b PdfAFormat = "PDF/A-1b"
PdfA2b PdfAFormat = "PDF/A-2b"
PdfA3b PdfAFormat = "PDF/A-3b"
Expand Down Expand Up @@ -65,7 +65,7 @@ func (req *OfficeRequest) Metadata(jsonData []byte) {
req.values[formFieldMetadata] = string(jsonData)
}

// Specify whether multiple form fields exported are allowed to have the same field name.false
// Specify whether multiple form fields exported are allowed to have the same field name.false.
func (req *OfficeRequest) AllowDuplicateFieldNames() {
req.values[formFieldAllowDuplicateFieldNames] = strconv.FormatBool(true)
}
Expand Down
4 changes: 2 additions & 2 deletions test/testfunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func IsPDF(filePath string) (bool, error) {
return false, nil
}

// IsPDFA checks if the given PDF file is PDF/A compliant
// IsPDFA checks if the given PDF file is PDF/A compliant.
func IsPDFA(filePath string) (bool, error) {
file, err := os.Open(filePath)
if err != nil {
Expand All @@ -109,7 +109,7 @@ func IsPDFA(filePath string) (bool, error) {
return false, nil
}

// IsPDFUA checks if the given PDF file is PDF/UA compliant
// IsPDFUA checks if the given PDF file is PDF/UA compliant.
func IsPDFUA(filePath string) (bool, error) {
file, err := os.Open(filePath)
if err != nil {
Expand Down

0 comments on commit 6b9116e

Please sign in to comment.