mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 11:52:14 +01:00
fixing Go Report Card issues
This commit is contained in:
@@ -15,7 +15,7 @@ At TheCodingMachine, we build a lot of web applications (intranets, extranets an
|
|||||||
* Performance :zap:: Google Chrome and Libreoffice (unoconv) started once in the background thanks to PM2
|
* Performance :zap:: Google Chrome and Libreoffice (unoconv) started once in the background thanks to PM2
|
||||||
* Failure prevention :broken_heart:: PM2 automatically restarts previous processes if they fail
|
* Failure prevention :broken_heart:: PM2 automatically restarts previous processes if they fail
|
||||||
* Assets :package:: send your header, footer, images, fonts, stylesheets and so on for converting your HTML and Markdown to beaufitul PDFs!
|
* Assets :package:: send your header, footer, images, fonts, stylesheets and so on for converting your HTML and Markdown to beaufitul PDFs!
|
||||||
* Easily interact with the API using our [Go](/pkg) and [PHP](https://github.com/thecodingmachine/gotenberg-php-client) libraries
|
* Easily interact with the API using our [Go](/pkg) and [PHP](https://github.com/thecodingmachine/gotenberg-php-client) (**WIP**) libraries
|
||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ const defaultHeaderFooterHTML string = "<html><head></head><body></body></html>"
|
|||||||
|
|
||||||
// Print converts HTML to PDF.
|
// Print converts HTML to PDF.
|
||||||
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
// Credits: https://medium.com/compass-true-north/go-service-to-convert-web-pages-to-pdf-using-headless-chrome-5fd9ffbae1af
|
||||||
|
// nolint: gocyclo
|
||||||
func (html *HTML) Print(destination string) error {
|
func (html *HTML) Print(destination string) error {
|
||||||
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
// use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers).
|
||||||
devt := devtool.New("http://127.0.0.1:9222")
|
devt := devtool.New("http://127.0.0.1:9222")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func Merge(fpaths []string, destination string) error {
|
|||||||
|
|
||||||
func writeBytesToFile(dst string, b []byte) error {
|
func writeBytesToFile(dst string, b []byte) error {
|
||||||
if err := ioutil.WriteFile(dst, b, 0644); err != nil {
|
if err := ioutil.WriteFile(dst, b, 0644); err != nil {
|
||||||
return fmt.Errorf("%s: writting file: %v", dst, err)
|
return fmt.Errorf("%s: writing file: %v", dst, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ func multipartForm(req Request) (*bytes.Buffer, string, error) {
|
|||||||
}
|
}
|
||||||
for name, value := range req.getFormValues() {
|
for name, value := range req.getFormValues() {
|
||||||
if err := writer.WriteField(name, value); err != nil {
|
if err := writer.WriteField(name, value); err != nil {
|
||||||
return nil, "", fmt.Errorf("%s: writting form field: %v", name, err)
|
return nil, "", fmt.Errorf("%s: writing form field: %v", name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return body, writer.FormDataContentType(), nil
|
return body, writer.FormDataContentType(), nil
|
||||||
|
|||||||
Reference in New Issue
Block a user