├── 1.10 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora ├── Dockerfile ├── Dockerfile.rhel7 └── README.md ├── 1.11 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.12 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.13 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.14 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.15 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.8 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── 1.9 ├── test ├── s2i │ └── bin │ │ ├── run │ │ ├── save-artifacts │ │ ├── usage │ │ └── assemble ├── root │ └── opt │ │ └── app-root │ │ └── etc │ │ └── scl_enable ├── Dockerfile.fedora └── README.md ├── test ├── simple-app │ ├── s2i-build │ └── app │ │ └── hello.go ├── complete-app │ ├── s2i-build │ ├── s2i-build-incremental │ └── app │ │ ├── welcome │ │ └── welcome.go │ │ └── hello.go ├── import-with-vendor-app │ ├── app │ │ ├── vendor │ │ │ └── github.com │ │ │ │ └── russross │ │ │ │ └── blackfriday │ │ │ │ ├── testdata │ │ │ │ ├── Nested blockquotes.text │ │ │ │ ├── Tidyness.text │ │ │ │ ├── Nested blockquotes.html │ │ │ │ ├── Strong and em together.text │ │ │ │ ├── Literal quotes in titles.text │ │ │ │ ├── Tidyness.html │ │ │ │ ├── Code Spans.text │ │ │ │ ├── Literal quotes in titles.html │ │ │ │ ├── Blockquotes with code blocks.text │ │ │ │ ├── Inline HTML (Advanced).text │ │ │ │ ├── Inline HTML comments.text │ │ │ │ ├── Code Spans.html │ │ │ │ ├── Inline HTML (Advanced).html │ │ │ │ ├── Strong and em together.html │ │ │ │ ├── Hard-wrapped paragraphs with list-like lines.text │ │ │ │ ├── Code Blocks.text │ │ │ │ ├── Inline HTML comments.html │ │ │ │ ├── Hard-wrapped paragraphs with list-like lines.html │ │ │ │ ├── Hard-wrapped paragraphs with list-like lines no empty line before block.text │ │ │ │ ├── Blockquotes with code blocks.html │ │ │ │ ├── Links, inline style.text │ │ │ │ ├── Links, shortcut references.html │ │ │ │ ├── Auto links.text │ │ │ │ ├── Links, shortcut references.text │ │ │ │ ├── Hard-wrapped paragraphs with list-like lines no empty line before block.html │ │ │ │ ├── Code Blocks.html │ │ │ │ ├── Links, inline style.html │ │ │ │ ├── Tabs.text │ │ │ │ ├── Amps and angle encoding.text │ │ │ │ ├── Tabs.html │ │ │ │ ├── Amps and angle encoding.html │ │ │ │ ├── Horizontal rules.text │ │ │ │ ├── Auto links.html │ │ │ │ ├── Horizontal rules.html │ │ │ │ ├── Inline HTML (Simple).text │ │ │ │ ├── Inline HTML (Simple).html │ │ │ │ ├── Links, reference style.text │ │ │ │ ├── Links, reference style.html │ │ │ │ ├── Ordered and unordered lists.text │ │ │ │ ├── Backslash escapes.text │ │ │ │ ├── Backslash escapes.html │ │ │ │ ├── Ordered and unordered lists.html │ │ │ │ ├── Markdown Documentation - Basics.text │ │ │ │ └── Markdown Documentation - Basics.html │ │ │ │ ├── .gitignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── LICENSE.txt │ │ │ │ ├── doc.go │ │ │ │ ├── markdown_test.go │ │ │ │ ├── ref_test.go │ │ │ │ ├── latex.go │ │ │ │ ├── README.md │ │ │ │ └── smartypants.go │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── Gopkg.lock │ │ ├── md2man │ │ │ ├── md2man.go │ │ │ ├── roff_test.go │ │ │ └── roff.go │ │ ├── Gopkg.toml │ │ ├── go-md2man.1.md │ │ ├── md2man.go │ │ └── LICENSE.md │ ├── s2i-build │ └── s2i-build-incremental ├── import-without-vendor-app │ ├── s2i-build │ ├── s2i-build-incremental │ └── app │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── Gopkg.lock │ │ ├── md2man │ │ ├── md2man.go │ │ ├── roff_test.go │ │ └── roff.go │ │ ├── Gopkg.toml │ │ ├── go-md2man.1.md │ │ ├── md2man.go │ │ └── LICENSE.md └── run ├── .gitmodules ├── Makefile ├── .gitignore ├── LICENSE ├── README.md └── imagestreams ├── golang-rhel-aarch64.json ├── golang-rhel.json └── golang-centos.json /1.10/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.11/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.12/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.13/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.14/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.15/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.8/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.9/test: -------------------------------------------------------------------------------- 1 | ../test/ -------------------------------------------------------------------------------- /1.10/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.11/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.12/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.13/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.14/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.15/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.8/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /1.9/s2i/bin/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | exec /opt/app-root/gobinary 6 | -------------------------------------------------------------------------------- /test/simple-app/s2i-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "common"] 2 | path = common 3 | url = https://github.com/sclorg/container-common-scripts.git 4 | -------------------------------------------------------------------------------- /test/complete-app/s2i-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build -e IMPORT_URL='complete-app' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Nested blockquotes.text: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.swp 3 | *.8 4 | *.6 5 | _obj 6 | _test* 7 | markdown 8 | tags 9 | -------------------------------------------------------------------------------- /test/complete-app/s2i-build-incremental: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build --incremental -e IMPORT_URL='complete-app' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/s2i-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/s2i-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/s2i-build-incremental: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build --incremental -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/s2i-build-incremental: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | s2i build --incremental -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp 3 | -------------------------------------------------------------------------------- /1.8/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [[ -d $HOME/go/pkg ]]; then 6 | 7 | pushd $HOME/go &> /dev/null 8 | 9 | tar -cf - pkg 10 | 11 | popd &> /dev/null 12 | 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /1.9/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [[ -d $HOME/go/pkg ]]; then 6 | 7 | pushd $HOME/go &> /dev/null 8 | 9 | tar -cf - pkg 10 | 11 | popd &> /dev/null 12 | 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Nested blockquotes.html: -------------------------------------------------------------------------------- 1 |
2 |

foo

3 | 4 |
5 |

bar

6 |
7 | 8 |

foo

9 |
10 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Strong and em together.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Literal quotes in titles.text: -------------------------------------------------------------------------------- 1 | Foo [bar][]. 2 | 3 | Foo [bar](/url/ "Title with "quotes" inside"). 4 | 5 | 6 | [bar]: /url/ "Title with "quotes" inside" 7 | 8 | -------------------------------------------------------------------------------- /test/complete-app/app/welcome/welcome.go: -------------------------------------------------------------------------------- 1 | package welcome 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func Welcome(w http.ResponseWriter, req *http.Request) { 9 | 10 | fmt.Fprintf(w, "Welcome to the Go toolset.") 11 | 12 | } 13 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Tidyness.html: -------------------------------------------------------------------------------- 1 |
2 |

A list within a blockquote:

3 | 4 | 9 |
10 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Code Spans.text: -------------------------------------------------------------------------------- 1 | `` 2 | 3 | Fix for backticks within HTML tag: like this 4 | 5 | Here's how you put `` `backticks` `` in a code span. 6 | 7 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Literal quotes in titles.html: -------------------------------------------------------------------------------- 1 |

Foo bar.

2 | 3 |

Foo bar.

4 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Blockquotes with code blocks.text: -------------------------------------------------------------------------------- 1 | > Example: 2 | > 3 | > sub status { 4 | > print "working"; 5 | > } 6 | > 7 | > Or: 8 | > 9 | > sub status { 10 | > return "working"; 11 | > } 12 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8 AS build 2 | COPY . /go/src/github.com/cpuguy83/go-md2man 3 | WORKDIR /go/src/github.com/cpuguy83/go-md2man 4 | RUN CGO_ENABLED=0 go build 5 | 6 | FROM scratch 7 | COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man 8 | ENTRYPOINT ["/go-md2man"] 9 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML (Advanced).text: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |
foo
4 | 5 | And nested without indentation: 6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML comments.text: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | Paragraph two. 10 | 11 | 12 | 13 | The end. 14 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8 AS build 2 | COPY . /go/src/github.com/cpuguy83/go-md2man 3 | WORKDIR /go/src/github.com/cpuguy83/go-md2man 4 | RUN CGO_ENABLED=0 go build 5 | 6 | FROM scratch 7 | COPY --from=build /go/src/github.com/cpuguy83/go-md2man/go-md2man /go-md2man 8 | ENTRYPOINT ["/go-md2man"] 9 | -------------------------------------------------------------------------------- /1.10/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.11/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.12/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.13/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.14/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.15/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.8/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /1.9/root/opt/app-root/etc/scl_enable: -------------------------------------------------------------------------------- 1 | # IMPORTANT: Do not add more content to this file unless you know what you are 2 | # doing. This file is sourced everytime the shell session is opened. 3 | # This will make scl collection binaries work out of box. 4 | unset BASH_ENV PROMPT_COMMAND ENV 5 | source scl_source enable go-toolset-7 6 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Code Spans.html: -------------------------------------------------------------------------------- 1 |

<test a=" content of attribute ">

2 | 3 |

Fix for backticks within HTML tag: like this

4 | 5 |

Here's how you put `backticks` in a code span.

6 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML (Advanced).html: -------------------------------------------------------------------------------- 1 |

Simple block on one line:

2 | 3 |
foo
4 | 5 |

And nested without indentation:

6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Strong and em together.html: -------------------------------------------------------------------------------- 1 |

This is strong and em.

2 | 3 |

So is this word.

4 | 5 |

This is strong and em.

6 | 7 |

So is this word.

8 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines.text: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Code Blocks.text: -------------------------------------------------------------------------------- 1 | code block on the first line 2 | 3 | Regular text. 4 | 5 | code block indented by spaces 6 | 7 | Regular text. 8 | 9 | the lines in this block 10 | all contain trailing spaces 11 | 12 | Regular Text. 13 | 14 | code block on the last line -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML comments.html: -------------------------------------------------------------------------------- 1 |

Paragraph one.

2 | 3 | 4 | 5 | 8 | 9 |

Paragraph two.

10 | 11 | 12 | 13 |

The end.

14 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines.html: -------------------------------------------------------------------------------- 1 |

In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item.

6 | 7 |

Here's one with a bullet. 8 | * criminey.

9 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines no empty line before block.text: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Blockquotes with code blocks.html: -------------------------------------------------------------------------------- 1 |
2 |

Example:

3 | 4 |
sub status {
 5 |     print "working";
 6 | }
 7 | 
8 | 9 |

Or:

10 | 11 |
sub status {
12 |     return "working";
13 | }
14 | 
15 |
16 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, inline style.text: -------------------------------------------------------------------------------- 1 | Just a [URL](/url/). 2 | 3 | [URL and title](/url/ "title"). 4 | 5 | [URL and title](/url/ "title preceded by two spaces"). 6 | 7 | [URL and title](/url/ "title preceded by a tab"). 8 | 9 | [URL and title](/url/ "title has spaces afterward" ). 10 | 11 | 12 | [Empty](). 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Include common Makefile code. 2 | BASE_IMAGE_NAME = golang 3 | VERSIONS = 1.13 1.14 1.15 4 | OPENSHIFT_NAMESPACES = 5 | 6 | # HACK: Ensure that 'git pull' for old clones doesn't cause confusion. 7 | # New clones should use '--recursive'. 8 | .PHONY: $(shell test -f common/common.mk || echo >&2 'Please do "git submodule update --init" first.') 9 | 10 | include common/common.mk 11 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, shortcut references.html: -------------------------------------------------------------------------------- 1 |

This is the simple case.

2 | 3 |

This one has a line 4 | break.

5 | 6 |

This one has a line 7 | break with a line-ending space.

8 | 9 |

this and the other

10 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Auto links.text: -------------------------------------------------------------------------------- 1 | Link: . 2 | 3 | With an ampersand: 4 | 5 | * In a list? 6 | * 7 | * It should. 8 | 9 | > Blockquoted: 10 | 11 | Auto-links should not occur here: `` 12 | 13 | or here: -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, shortcut references.text: -------------------------------------------------------------------------------- 1 | This is the [simple case]. 2 | 3 | [simple case]: /simple 4 | 5 | 6 | 7 | This one has a [line 8 | break]. 9 | 10 | This one has a [line 11 | break] with a line-ending space. 12 | 13 | [line break]: /foo 14 | 15 | 16 | [this] [that] and the [other] 17 | 18 | [this]: /this 19 | [that]: /that 20 | [other]: /other 21 | -------------------------------------------------------------------------------- /1.10/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d $HOME/go/pkg ]]; then 8 | 9 | mv $HOME/go/pkg pkg &> /dev/null 10 | TOSAVE=$TOSAVE"./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE=$TOSAVE"./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - $TOSAVE 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /1.11/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d $HOME/go/pkg ]]; then 8 | 9 | mv $HOME/go/pkg pkg &> /dev/null 10 | TOSAVE=$TOSAVE"./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE=$TOSAVE"./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - $TOSAVE 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /1.13/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d $HOME/go/pkg ]]; then 8 | 9 | mv $HOME/go/pkg pkg &> /dev/null 10 | TOSAVE=$TOSAVE"./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE=$TOSAVE"./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - $TOSAVE 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /1.14/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d $HOME/go/pkg ]]; then 8 | 9 | mv $HOME/go/pkg pkg &> /dev/null 10 | TOSAVE=$TOSAVE"./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE=$TOSAVE"./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - $TOSAVE 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /1.15/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d $HOME/go/pkg ]]; then 8 | 9 | mv $HOME/go/pkg pkg &> /dev/null 10 | TOSAVE=$TOSAVE"./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE=$TOSAVE"./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - $TOSAVE 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /1.12/s2i/bin/save-artifacts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | TOSAVE="" 6 | 7 | if [[ -d "$HOME/go/pkg" ]]; then 8 | 9 | mv "$HOME/go/pkg" pkg &> /dev/null 10 | TOSAVE="$TOSAVE./pkg " 11 | 12 | fi 13 | 14 | if [[ -d `go env GOCACHE` ]]; then 15 | 16 | mv `go env GOCACHE` go-build &> /dev/null 17 | TOSAVE="$TOSAVE./go-build " 18 | 19 | fi 20 | 21 | if [[ -n "$TOSAVE" ]]; then 22 | 23 | tar -cf - "$TOSAVE" 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Hard-wrapped paragraphs with list-like lines no empty line before block.html: -------------------------------------------------------------------------------- 1 |

In Markdown 1.0.0 and earlier. Version

2 | 3 |
    4 |
  1. This line turns into a list item. 5 | Because a hard-wrapped line in the 6 | middle of a paragraph looked like a 7 | list item.
  2. 8 |
9 | 10 |

Here's one with a bullet.

11 | 12 |
    13 |
  • criminey.
  • 14 |
15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite3 2 | staticfiles/ 3 | openshift.local.* 4 | 5 | # help.1 files complied by container-common-scripts from README.md files 6 | */root/help.1 7 | 8 | # generated id files 9 | .image-id 10 | .image-id.raw 11 | 12 | # C extensions 13 | *.so 14 | 15 | # Unit test / coverage reports 16 | htmlcov/ 17 | .tox/ 18 | .coverage 19 | .coverage.* 20 | .cache 21 | nosetests.xml 22 | coverage.xml 23 | *,cover 24 | 25 | # Translations 26 | *.mo 27 | *.pot 28 | -------------------------------------------------------------------------------- /test/complete-app/app/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "complete-app/welcome" 5 | "fmt" 6 | "net/http" 7 | ) 8 | 9 | func main() { 10 | 11 | fmt.Println("Hello.") 12 | fmt.Println("Starting http server.") 13 | 14 | // Register handler function 15 | 16 | http.HandleFunc("/welcome", welcome.Welcome) 17 | 18 | fmt.Println("Go to localhost:8080/welcome To terminate press CTRL+C") 19 | 20 | // Start server 21 | 22 | http.ListenAndServe(":8080", nil) 23 | } 24 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Code Blocks.html: -------------------------------------------------------------------------------- 1 |
code block on the first line
 2 | 
3 | 4 |

Regular text.

5 | 6 |
code block indented by spaces
 7 | 
8 | 9 |

Regular text.

10 | 11 |
the lines in this block  
12 | all contain trailing spaces  
13 | 
14 | 15 |

Regular Text.

16 | 17 |
code block on the last line
18 | 
19 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, inline style.html: -------------------------------------------------------------------------------- 1 |

Just a URL.

2 | 3 |

URL and title.

4 | 5 |

URL and title.

6 | 7 |

URL and title.

8 | 9 |

URL and title.

10 | 11 |

[Empty]().

12 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Tabs.text: -------------------------------------------------------------------------------- 1 | + this is a list item 2 | indented with tabs 3 | 4 | + this is a list item 5 | indented with spaces 6 | 7 | Code: 8 | 9 | this code block is indented by one tab 10 | 11 | And: 12 | 13 | this code block is indented by two tabs 14 | 15 | And: 16 | 17 | + this is an example list item 18 | indented with tabs 19 | 20 | + this is an example list item 21 | indented with spaces 22 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/README.md: -------------------------------------------------------------------------------- 1 | go-md2man 2 | ========= 3 | 4 | ** Work in Progress ** 5 | This still needs a lot of help to be complete, or even usable! 6 | 7 | Uses blackfriday to process markdown into man pages. 8 | 9 | ### Usage 10 | 11 | ./md2man -in /path/to/markdownfile.md -out /manfile/output/path 12 | 13 | ### How to contribute 14 | 15 | We use [govend](https://github.com/govend/govend) for vendoring Go packages. 16 | 17 | How to update dependencies: `govend -v -u --prune` 18 | 19 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/README.md: -------------------------------------------------------------------------------- 1 | go-md2man 2 | ========= 3 | 4 | ** Work in Progress ** 5 | This still needs a lot of help to be complete, or even usable! 6 | 7 | Uses blackfriday to process markdown into man pages. 8 | 9 | ### Usage 10 | 11 | ./md2man -in /path/to/markdownfile.md -out /manfile/output/path 12 | 13 | ### How to contribute 14 | 15 | We use [govend](https://github.com/govend/govend) for vendoring Go packages. 16 | 17 | How to update dependencies: `govend -v -u --prune` 18 | 19 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | name = "github.com/russross/blackfriday" 6 | packages = ["."] 7 | revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c" 8 | version = "v1.5" 9 | 10 | [solve-meta] 11 | analyzer-name = "dep" 12 | analyzer-version = 1 13 | inputs-digest = "d4fdd599038b13752bbcaf722cac55d8e6d81b6fd60bb325df3e31d71aaf358c" 14 | solver-name = "gps-cdcl" 15 | solver-version = 1 16 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/Gopkg.lock: -------------------------------------------------------------------------------- 1 | # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. 2 | 3 | 4 | [[projects]] 5 | name = "github.com/russross/blackfriday" 6 | packages = ["."] 7 | revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c" 8 | version = "v1.5" 9 | 10 | [solve-meta] 11 | analyzer-name = "dep" 12 | analyzer-version = 1 13 | inputs-digest = "d4fdd599038b13752bbcaf722cac55d8e6d81b6fd60bb325df3e31d71aaf358c" 14 | solver-name = "gps-cdcl" 15 | solver-version = 1 16 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Amps and angle encoding.text: -------------------------------------------------------------------------------- 1 | AT&T has an ampersand in their name. 2 | 3 | AT&T is another way to write it. 4 | 5 | This & that. 6 | 7 | 4 < 5. 8 | 9 | 6 > 5. 10 | 11 | Here's a [link] [1] with an ampersand in the URL. 12 | 13 | Here's a link with an amersand in the link text: [AT&T] [2]. 14 | 15 | Here's an inline [link](/script?foo=1&bar=2). 16 | 17 | Here's an inline [link](). 18 | 19 | 20 | [1]: http://example.com/?foo=1&bar=2 21 | [2]: http://att.com/ "AT&T" -------------------------------------------------------------------------------- /test/simple-app/app/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func Welcome(w http.ResponseWriter, req *http.Request) { 9 | 10 | fmt.Fprintf(w, "Welcome to the Go toolset.") 11 | 12 | } 13 | 14 | func main() { 15 | 16 | fmt.Println("Hello.") 17 | fmt.Println("Starting http server.") 18 | 19 | // Register handler function 20 | 21 | http.HandleFunc("/welcome", Welcome) 22 | 23 | fmt.Println("Go to localhost:8080/welcome To terminate press CTRL+C") 24 | 25 | // Start server 26 | 27 | http.ListenAndServe(":8080", nil) 28 | } 29 | -------------------------------------------------------------------------------- /1.8/s2i/bin/usage: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DISTRO=`cat /etc/*-release | grep ^ID= | tr "=" "\n" | grep -v ^ID | grep -o '\w*'` 4 | NAMESPACE=centos 5 | [[ $DISTRO =~ rhel* ]] && NAMESPACE=rhscl 6 | 7 | cat < 2 |
  • this is a list item 3 | indented with tabs

  • 4 | 5 |
  • this is a list item 6 | indented with spaces

  • 7 | 8 | 9 |

    Code:

    10 | 11 |
    this code block is indented by one tab
    12 | 
    13 | 14 |

    And:

    15 | 16 |
        this code block is indented by two tabs
    17 | 
    18 | 19 |

    And:

    20 | 21 |
    +   this is an example list item
    22 |     indented with tabs
    23 | 
    24 | +   this is an example list item
    25 |     indented with spaces
    26 | 
    27 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/md2man/md2man.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "github.com/russross/blackfriday" 5 | ) 6 | 7 | func Render(doc []byte) []byte { 8 | renderer := RoffRenderer(0) 9 | extensions := 0 10 | extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS 11 | extensions |= blackfriday.EXTENSION_TABLES 12 | extensions |= blackfriday.EXTENSION_FENCED_CODE 13 | extensions |= blackfriday.EXTENSION_AUTOLINK 14 | extensions |= blackfriday.EXTENSION_SPACE_HEADERS 15 | extensions |= blackfriday.EXTENSION_FOOTNOTES 16 | extensions |= blackfriday.EXTENSION_TITLEBLOCK 17 | 18 | return blackfriday.Markdown(doc, renderer, extensions) 19 | } 20 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/md2man/md2man.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "github.com/russross/blackfriday" 5 | ) 6 | 7 | func Render(doc []byte) []byte { 8 | renderer := RoffRenderer(0) 9 | extensions := 0 10 | extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS 11 | extensions |= blackfriday.EXTENSION_TABLES 12 | extensions |= blackfriday.EXTENSION_FENCED_CODE 13 | extensions |= blackfriday.EXTENSION_AUTOLINK 14 | extensions |= blackfriday.EXTENSION_SPACE_HEADERS 15 | extensions |= blackfriday.EXTENSION_FOOTNOTES 16 | extensions |= blackfriday.EXTENSION_TITLEBLOCK 17 | 18 | return blackfriday.Markdown(doc, renderer, extensions) 19 | } 20 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Amps and angle encoding.html: -------------------------------------------------------------------------------- 1 |

    AT&T has an ampersand in their name.

    2 | 3 |

    AT&T is another way to write it.

    4 | 5 |

    This & that.

    6 | 7 |

    4 < 5.

    8 | 9 |

    6 > 5.

    10 | 11 |

    Here's a link with an ampersand in the URL.

    12 | 13 |

    Here's a link with an amersand in the link text: AT&T.

    14 | 15 |

    Here's an inline link.

    16 | 17 |

    Here's an inline link.

    18 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Horizontal rules.text: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Auto links.html: -------------------------------------------------------------------------------- 1 |

    Link: http://example.com/.

    2 | 3 |

    With an ampersand: http://example.com/?foo=1&bar=2

    4 | 5 | 10 | 11 |
    12 |

    Blockquoted: http://example.com/

    13 |
    14 | 15 |

    Auto-links should not occur here: <http://example.com/>

    16 | 17 |
    or here: <http://example.com/>
    18 | 
    19 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/russross/blackfriday" 26 | version = "1.4" 27 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/Gopkg.toml: -------------------------------------------------------------------------------- 1 | 2 | # Gopkg.toml example 3 | # 4 | # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md 5 | # for detailed Gopkg.toml documentation. 6 | # 7 | # required = ["github.com/user/thing/cmd/thing"] 8 | # ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] 9 | # 10 | # [[constraint]] 11 | # name = "github.com/user/project" 12 | # version = "1.0.0" 13 | # 14 | # [[constraint]] 15 | # name = "github.com/user/project2" 16 | # branch = "dev" 17 | # source = "github.com/myfork/project2" 18 | # 19 | # [[override]] 20 | # name = "github.com/x/y" 21 | # version = "2.4.0" 22 | 23 | 24 | [[constraint]] 25 | name = "github.com/russross/blackfriday" 26 | version = "1.4" 27 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/go-md2man.1.md: -------------------------------------------------------------------------------- 1 | go-md2man 1 "January 2015" go-md2man "User Manual" 2 | ================================================== 3 | 4 | # NAME 5 | go-md2man - Convert mardown files into manpages 6 | 7 | # SYNOPSIS 8 | go-md2man -in=[/path/to/md/file] -out=[/path/to/output] 9 | 10 | # Description 11 | go-md2man converts standard markdown formatted documents into manpages. It is 12 | written purely in Go so as to reduce dependencies on 3rd party libs. 13 | 14 | By default, the input is stdin and the output is stdout. 15 | 16 | # Example 17 | Convert the markdown file "go-md2man.1.md" into a manpage. 18 | 19 | go-md2man -in=README.md -out=go-md2man.1.out 20 | 21 | # HISTORY 22 | January 2015, Originally compiled by Brian Goff( cpuguy83@gmail.com ) 23 | 24 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/go-md2man.1.md: -------------------------------------------------------------------------------- 1 | go-md2man 1 "January 2015" go-md2man "User Manual" 2 | ================================================== 3 | 4 | # NAME 5 | go-md2man - Convert mardown files into manpages 6 | 7 | # SYNOPSIS 8 | go-md2man -in=[/path/to/md/file] -out=[/path/to/output] 9 | 10 | # Description 11 | go-md2man converts standard markdown formatted documents into manpages. It is 12 | written purely in Go so as to reduce dependencies on 3rd party libs. 13 | 14 | By default, the input is stdin and the output is stdout. 15 | 16 | # Example 17 | Convert the markdown file "go-md2man.1.md" into a manpage. 18 | 19 | go-md2man -in=README.md -out=go-md2man.1.out 20 | 21 | # HISTORY 22 | January 2015, Originally compiled by Brian Goff( cpuguy83@gmail.com ) 23 | 24 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Horizontal rules.html: -------------------------------------------------------------------------------- 1 |

    Dashes:

    2 | 3 |
    4 | 5 |
    6 | 7 |
    8 | 9 |
    10 | 11 |
    ---
    12 | 
    13 | 14 |
    15 | 16 |
    17 | 18 |
    19 | 20 |
    21 | 22 |
    - - -
    23 | 
    24 | 25 |

    Asterisks:

    26 | 27 |
    28 | 29 |
    30 | 31 |
    32 | 33 |
    34 | 35 |
    ***
    36 | 
    37 | 38 |
    39 | 40 |
    41 | 42 |
    43 | 44 |
    45 | 46 |
    * * *
    47 | 
    48 | 49 |

    Underscores:

    50 | 51 |
    52 | 53 |
    54 | 55 |
    56 | 57 |
    58 | 59 |
    ___
    60 | 
    61 | 62 |
    63 | 64 |
    65 | 66 |
    67 | 68 |
    69 | 70 |
    _ _ _
    71 | 
    72 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | go: 4 | - 1.5.4 5 | - 1.6.2 6 | - tip 7 | matrix: 8 | include: 9 | - go: 1.2.2 10 | script: 11 | - go get -t -v ./... 12 | - go test -v -race ./... 13 | - go: 1.3.3 14 | script: 15 | - go get -t -v ./... 16 | - go test -v -race ./... 17 | - go: 1.4.3 18 | script: 19 | - go get -t -v ./... 20 | - go test -v -race ./... 21 | allow_failures: 22 | - go: tip 23 | fast_finish: true 24 | install: 25 | - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). 26 | script: 27 | - go get -t -v ./... 28 | - diff -u <(echo -n) <(gofmt -d -s .) 29 | - go tool vet . 30 | - go test -v -race ./... 31 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML (Simple).text: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |
    4 | foo 5 |
    6 | 7 | This should be a code block, though: 8 | 9 |
    10 | foo 11 |
    12 | 13 | As should this: 14 | 15 |
    foo
    16 | 17 | Now, nested: 18 | 19 |
    20 |
    21 |
    22 | foo 23 |
    24 |
    25 |
    26 | 27 | This should just be an HTML comment: 28 | 29 | 30 | 31 | Multiline: 32 | 33 | 37 | 38 | Code block: 39 | 40 | 41 | 42 | Just plain comment, with trailing spaces on the line: 43 | 44 | 45 | 46 | Code: 47 | 48 |
    49 | 50 | Hr's: 51 | 52 |
    53 | 54 |
    55 | 56 |
    57 | 58 |
    59 | 60 |
    61 | 62 |
    63 | 64 |
    65 | 66 |
    67 | 68 |
    69 | 70 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/md2man.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | 9 | "github.com/cpuguy83/go-md2man/md2man" 10 | ) 11 | 12 | var inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)") 13 | var outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)") 14 | 15 | func main() { 16 | var err error 17 | flag.Parse() 18 | 19 | inFile := os.Stdin 20 | if *inFilePath != "" { 21 | inFile, err = os.Open(*inFilePath) 22 | if err != nil { 23 | fmt.Println(err) 24 | os.Exit(1) 25 | } 26 | } 27 | defer inFile.Close() 28 | 29 | doc, err := ioutil.ReadAll(inFile) 30 | if err != nil { 31 | fmt.Println(err) 32 | os.Exit(1) 33 | } 34 | 35 | out := md2man.Render(doc) 36 | 37 | outFile := os.Stdout 38 | if *outFilePath != "" { 39 | outFile, err = os.Create(*outFilePath) 40 | if err != nil { 41 | fmt.Println(err) 42 | os.Exit(1) 43 | } 44 | defer outFile.Close() 45 | } 46 | _, err = outFile.Write(out) 47 | if err != nil { 48 | fmt.Println(err) 49 | os.Exit(1) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/md2man.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "io/ioutil" 7 | "os" 8 | 9 | "github.com/cpuguy83/go-md2man/md2man" 10 | ) 11 | 12 | var inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)") 13 | var outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)") 14 | 15 | func main() { 16 | var err error 17 | flag.Parse() 18 | 19 | inFile := os.Stdin 20 | if *inFilePath != "" { 21 | inFile, err = os.Open(*inFilePath) 22 | if err != nil { 23 | fmt.Println(err) 24 | os.Exit(1) 25 | } 26 | } 27 | defer inFile.Close() 28 | 29 | doc, err := ioutil.ReadAll(inFile) 30 | if err != nil { 31 | fmt.Println(err) 32 | os.Exit(1) 33 | } 34 | 35 | out := md2man.Render(doc) 36 | 37 | outFile := os.Stdout 38 | if *outFilePath != "" { 39 | outFile, err = os.Create(*outFilePath) 40 | if err != nil { 41 | fmt.Println(err) 42 | os.Exit(1) 43 | } 44 | defer outFile.Close() 45 | } 46 | _, err = outFile.Write(out) 47 | if err != nil { 48 | fmt.Println(err) 49 | os.Exit(1) 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Software Collections 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Brian Goff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Brian Goff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Inline HTML (Simple).html: -------------------------------------------------------------------------------- 1 |

    Here's a simple block:

    2 | 3 |
    4 | foo 5 |
    6 | 7 |

    This should be a code block, though:

    8 | 9 |
    <div>
    10 |     foo
    11 | </div>
    12 | 
    13 | 14 |

    As should this:

    15 | 16 |
    <div>foo</div>
    17 | 
    18 | 19 |

    Now, nested:

    20 | 21 |
    22 |
    23 |
    24 | foo 25 |
    26 |
    27 |
    28 | 29 |

    This should just be an HTML comment:

    30 | 31 | 32 | 33 |

    Multiline:

    34 | 35 | 39 | 40 |

    Code block:

    41 | 42 |
    <!-- Comment -->
    43 | 
    44 | 45 |

    Just plain comment, with trailing spaces on the line:

    46 | 47 | 48 | 49 |

    Code:

    50 | 51 |
    <hr />
    52 | 
    53 | 54 |

    Hr's:

    55 | 56 |
    57 | 58 |
    59 | 60 |
    61 | 62 |
    63 | 64 |
    65 | 66 |
    67 | 68 |
    69 | 70 |
    71 | 72 |
    73 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, reference style.text: -------------------------------------------------------------------------------- 1 | Foo [bar] [1]. 2 | 3 | Foo [bar][1]. 4 | 5 | Foo [bar] 6 | [1]. 7 | 8 | [1]: /url/ "Title" 9 | 10 | 11 | With [embedded [brackets]] [b]. 12 | 13 | 14 | Indented [once][]. 15 | 16 | Indented [twice][]. 17 | 18 | Indented [thrice][]. 19 | 20 | Indented [four][] times. 21 | 22 | [once]: /url 23 | 24 | [twice]: /url 25 | 26 | [thrice]: /url 27 | 28 | [four]: /url 29 | 30 | 31 | [b]: /url/ 32 | 33 | * * * 34 | 35 | [this] [this] should work 36 | 37 | So should [this][this]. 38 | 39 | And [this] []. 40 | 41 | And [this][]. 42 | 43 | And [this]. 44 | 45 | But not [that] []. 46 | 47 | Nor [that][]. 48 | 49 | Nor [that]. 50 | 51 | [Something in brackets like [this][] should work] 52 | 53 | [Same with [this].] 54 | 55 | In this case, [this](/somethingelse/) points to something else. 56 | 57 | Backslashing should suppress \[this] and [this\]. 58 | 59 | [this]: foo 60 | 61 | 62 | * * * 63 | 64 | Here's one where the [link 65 | breaks] across lines. 66 | 67 | Here's another where the [link 68 | breaks] across lines, but with a line-ending space. 69 | 70 | 71 | [link breaks]: /url/ 72 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Links, reference style.html: -------------------------------------------------------------------------------- 1 |

    Foo bar.

    2 | 3 |

    Foo bar.

    4 | 5 |

    Foo bar.

    6 | 7 |

    With embedded [brackets].

    8 | 9 |

    Indented once.

    10 | 11 |

    Indented twice.

    12 | 13 |

    Indented thrice.

    14 | 15 |

    Indented [four][] times.

    16 | 17 |
    [four]: /url
    18 | 
    19 | 20 |
    21 | 22 |

    this should work

    23 | 24 |

    So should this.

    25 | 26 |

    And this.

    27 | 28 |

    And this.

    29 | 30 |

    And this.

    31 | 32 |

    But not [that] [].

    33 | 34 |

    Nor [that][].

    35 | 36 |

    Nor [that].

    37 | 38 |

    [Something in brackets like this should work]

    39 | 40 |

    [Same with this.]

    41 | 42 |

    In this case, this points to something else.

    43 | 44 |

    Backslashing should suppress [this] and [this].

    45 | 46 |
    47 | 48 |

    Here's one where the link 49 | breaks across lines.

    50 | 51 |

    Here's another where the link 52 | breaks across lines, but with a line-ending space.

    53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Golang container images 2 | ==================== 3 | 4 | This repository contains the source for building of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | For more information about contributing, see 11 | [the Contribution Guidelines](https://github.com/sclorg/welcome/blob/master/contribution.md). 12 | For more information about concepts used in these container images, see the 13 | [Landing page](https://github.com/sclorg/welcome). 14 | 15 | 16 | Versions 17 | --------------- 18 | Golang versions currently provided are: 19 | * [Golang 1.8 (go-toolset 7, where applicable)](1.8) 20 | * [Golang 1.12](1.12) 21 | 22 | RHEL versions currently supported are: 23 | * RHEL7 24 | 25 | CentOS versions currently supported are: 26 | * CentOS7 27 | 28 | Fedora versions currently supported are: 29 | * Fedora 30 30 | 31 | 32 | Usage 33 | --------------------------------- 34 | 35 | For information about usage of Dockerfile for Golang Toolset 7 and Fedora golang, 36 | see usage documentation for respective Go versions [Go1.8](1.8/README.md) [Go1.12](1.12/README.md). 37 | -------------------------------------------------------------------------------- /1.8/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | 29 | fi 30 | 31 | # Resolve dependencies, ignore if vendor present 32 | 33 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 34 | 35 | echo "Resolving dependencies" 36 | 37 | pushd $GOPATH/src/$INSTALL_URL 38 | 39 | go get 40 | 41 | popd 42 | 43 | fi 44 | 45 | # lets build 46 | 47 | pushd $GOPATH/src/$INSTALL_URL 48 | 49 | echo "Building" 50 | 51 | go install $INSTALL_URL 52 | 53 | mv $GOPATH/bin/* /opt/app-root/gobinary 54 | 55 | popd 56 | 57 | exit 58 | 59 | fi 60 | 61 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 62 | exec /$STI_SCRIPTS_PATH/usage 63 | 64 | else 65 | 66 | go build -o /opt/app-root/gobinary 67 | 68 | popd 69 | 70 | fi 71 | -------------------------------------------------------------------------------- /1.9/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | 29 | fi 30 | 31 | # Resolve dependencies, ignore if vendor present 32 | 33 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 34 | 35 | echo "Resolving dependencies" 36 | 37 | pushd $GOPATH/src/$INSTALL_URL 38 | 39 | go get 40 | 41 | popd 42 | 43 | fi 44 | 45 | # lets build 46 | 47 | pushd $GOPATH/src/$INSTALL_URL 48 | 49 | echo "Building" 50 | 51 | go install $INSTALL_URL 52 | 53 | mv $GOPATH/bin/* /opt/app-root/gobinary 54 | 55 | popd 56 | 57 | exit 58 | 59 | fi 60 | 61 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 62 | exec /$STI_SCRIPTS_PATH/usage 63 | 64 | else 65 | 66 | go build -o /opt/app-root/gobinary 67 | 68 | popd 69 | 70 | fi 71 | -------------------------------------------------------------------------------- /1.8/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f26/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.8 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.9/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f27/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.9 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.10/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f28/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.10 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.11/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f29/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.11 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.12/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f30/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.12 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang112,rh-golang112,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.13/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f31/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.13 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang113,rh-golang113,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.14/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f32/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.14 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang114,rh-golang114,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.15/Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | FROM registry.fedoraproject.org/f33/s2i-base:latest 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.15 \ 5 | ARCH=x86_64 6 | 7 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 8 | DESCRIPTION="Go $VERSION available as container is a base platform for \ 9 | building and running various Go $VERSION applications and frameworks. \ 10 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 11 | tradition with garbage collection, concurrent programming support, and memory safety features." 12 | 13 | LABEL summary="$SUMMARY" \ 14 | description="$DESCRIPTION" \ 15 | io.k8s.description="$DESCRIPTION" \ 16 | io.k8s.display-name="Go $VERSION" \ 17 | io.openshift.tags="builder,golang,golang115,rh-golang115,go" \ 18 | com.redhat.component="$NAME" \ 19 | name="$FGC/$NAME" \ 20 | version="$VERSION" \ 21 | architecture="$ARCH" \ 22 | maintainer="Jakub Cajka " \ 23 | usage="docker run $FGC/$NAME" 24 | 25 | RUN INSTALL_PKGS="golang" && \ 26 | dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | dnf clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | # Copy manpage 33 | COPY ./root/help.1 / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 /opt/app-root 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Blackfriday is distributed under the Simplified BSD License: 2 | 3 | > Copyright © 2011 Russ Ross 4 | > All rights reserved. 5 | > 6 | > Redistribution and use in source and binary forms, with or without 7 | > modification, are permitted provided that the following conditions 8 | > are met: 9 | > 10 | > 1. Redistributions of source code must retain the above copyright 11 | > notice, this list of conditions and the following disclaimer. 12 | > 13 | > 2. Redistributions in binary form must reproduce the above 14 | > copyright notice, this list of conditions and the following 15 | > disclaimer in the documentation and/or other materials provided with 16 | > the distribution. 17 | > 18 | > THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | > "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | > LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | > FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | > COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | > INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 | > BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | > LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | > CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 | > LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 | > ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | > POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /1.10/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos/s2i-base-centos7 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.10 5 | 6 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 7 | DESCRIPTION="Go $VERSION available as docker container is a base platform for \ 8 | building and running various Go $VERSION applications and frameworks. \ 9 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 10 | tradition with garbage collection, concurrent programming support, and memory safety features." 11 | 12 | LABEL summary="$SUMMARY" \ 13 | description="$DESCRIPTION" \ 14 | io.k8s.description="$DESCRIPTION" \ 15 | io.k8s.display-name="Go $VERSION" \ 16 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 17 | com.redhat.component="go-toolset-7" \ 18 | name="centos/go-toolset-7-centos7" \ 19 | version="1" \ 20 | maintainer="Jakub Čajka " \ 21 | usage="docker run centos/go-toolset-7-centos7" 22 | 23 | RUN yum install -y centos-release-scl-rh && \ 24 | yum-config-manager --enable centos-sclo-rh-testing && \ 25 | INSTALL_PKGS="go-toolset-7" && \ 26 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 27 | rpm -V $INSTALL_PKGS && \ 28 | yum clean all -y 29 | 30 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 31 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 32 | 33 | COPY ./root/ / 34 | 35 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 $APP_ROOT 36 | 37 | USER 1001 38 | 39 | # Set the default CMD to print the usage of the language image. 40 | CMD $STI_SCRIPTS_PATH/usage 41 | -------------------------------------------------------------------------------- /1.10/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | GOCACHE=`go env GOCACHE` 29 | mkdir -p $GOCACHE 30 | mv /tmp/artifacts/go-build $GOCACHE 31 | 32 | fi 33 | 34 | # Resolve dependencies, ignore if vendor present 35 | 36 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 37 | 38 | echo "Resolving dependencies" 39 | 40 | pushd $GOPATH/src/$INSTALL_URL 41 | 42 | go get 43 | 44 | popd 45 | 46 | fi 47 | 48 | # lets build 49 | 50 | pushd $GOPATH/src/$INSTALL_URL 51 | 52 | echo "Building" 53 | 54 | go install $INSTALL_URL 55 | 56 | mv $GOPATH/bin/* /opt/app-root/gobinary 57 | 58 | popd 59 | 60 | exit 61 | 62 | fi 63 | 64 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 65 | exec /$STI_SCRIPTS_PATH/usage 66 | 67 | else 68 | 69 | go build -o /opt/app-root/gobinary 70 | 71 | popd 72 | 73 | fi 74 | -------------------------------------------------------------------------------- /1.11/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | GOCACHE=`go env GOCACHE` 29 | mkdir -p $GOCACHE 30 | mv /tmp/artifacts/go-build $GOCACHE 31 | 32 | fi 33 | 34 | # Resolve dependencies, ignore if vendor present 35 | 36 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 37 | 38 | echo "Resolving dependencies" 39 | 40 | pushd $GOPATH/src/$INSTALL_URL 41 | 42 | go get 43 | 44 | popd 45 | 46 | fi 47 | 48 | # lets build 49 | 50 | pushd $GOPATH/src/$INSTALL_URL 51 | 52 | echo "Building" 53 | 54 | go install $INSTALL_URL 55 | 56 | mv $GOPATH/bin/* /opt/app-root/gobinary 57 | 58 | popd 59 | 60 | exit 61 | 62 | fi 63 | 64 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 65 | exec /$STI_SCRIPTS_PATH/usage 66 | 67 | else 68 | 69 | go build -o /opt/app-root/gobinary 70 | 71 | popd 72 | 73 | fi 74 | -------------------------------------------------------------------------------- /1.13/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | GOCACHE=`go env GOCACHE` 29 | mkdir -p $GOCACHE 30 | mv /tmp/artifacts/go-build $GOCACHE 31 | 32 | fi 33 | 34 | # Resolve dependencies, ignore if vendor present 35 | 36 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 37 | 38 | echo "Resolving dependencies" 39 | 40 | pushd $GOPATH/src/$INSTALL_URL 41 | 42 | go get 43 | 44 | popd 45 | 46 | fi 47 | 48 | # lets build 49 | 50 | pushd $GOPATH/src/$INSTALL_URL 51 | 52 | echo "Building" 53 | 54 | go install $INSTALL_URL 55 | 56 | mv $GOPATH/bin/* /opt/app-root/gobinary 57 | 58 | popd 59 | 60 | exit 61 | 62 | fi 63 | 64 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 65 | exec /$STI_SCRIPTS_PATH/usage 66 | 67 | else 68 | 69 | go build -o /opt/app-root/gobinary 70 | 71 | popd 72 | 73 | fi 74 | -------------------------------------------------------------------------------- /1.14/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | GOCACHE=`go env GOCACHE` 29 | mkdir -p $GOCACHE 30 | mv /tmp/artifacts/go-build $GOCACHE 31 | 32 | fi 33 | 34 | # Resolve dependencies, ignore if vendor present 35 | 36 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 37 | 38 | echo "Resolving dependencies" 39 | 40 | pushd $GOPATH/src/$INSTALL_URL 41 | 42 | go get 43 | 44 | popd 45 | 46 | fi 47 | 48 | # lets build 49 | 50 | pushd $GOPATH/src/$INSTALL_URL 51 | 52 | echo "Building" 53 | 54 | go install $INSTALL_URL 55 | 56 | mv $GOPATH/bin/* /opt/app-root/gobinary 57 | 58 | popd 59 | 60 | exit 61 | 62 | fi 63 | 64 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 65 | exec /$STI_SCRIPTS_PATH/usage 66 | 67 | else 68 | 69 | go build -o /opt/app-root/gobinary 70 | 71 | popd 72 | 73 | fi 74 | -------------------------------------------------------------------------------- /1.15/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p $GOPATH/src/$IMPORT_URL 20 | 21 | mv /tmp/src/* $GOPATH/src/$IMPORT_URL 22 | 23 | if [[ -d /tmp/artifacts/pkg || -d /tmp/artifacts/go-build ]]; then 24 | 25 | echo "Restoring previous build artifacts" 26 | 27 | mv /tmp/artifacts/pkg $GOPATH 28 | GOCACHE=`go env GOCACHE` 29 | mkdir -p $GOCACHE 30 | mv /tmp/artifacts/go-build $GOCACHE 31 | 32 | fi 33 | 34 | # Resolve dependencies, ignore if vendor present 35 | 36 | if [[ ! -d $GOPATH/src/$INSTALL_URL/vendor && `go list -f {{.Incomplete}} $INSTALL_URL` == "true" ]]; then 37 | 38 | echo "Resolving dependencies" 39 | 40 | pushd $GOPATH/src/$INSTALL_URL 41 | 42 | go get 43 | 44 | popd 45 | 46 | fi 47 | 48 | # lets build 49 | 50 | pushd $GOPATH/src/$INSTALL_URL 51 | 52 | echo "Building" 53 | 54 | go install $INSTALL_URL 55 | 56 | mv $GOPATH/bin/* /opt/app-root/gobinary 57 | 58 | popd 59 | 60 | exit 61 | 62 | fi 63 | 64 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 65 | exec /$STI_SCRIPTS_PATH/usage 66 | 67 | else 68 | 69 | go build -o /opt/app-root/gobinary 70 | 71 | popd 72 | 73 | fi 74 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Ordered and unordered lists.text: -------------------------------------------------------------------------------- 1 | ## Unordered 2 | 3 | Asterisks tight: 4 | 5 | * asterisk 1 6 | * asterisk 2 7 | * asterisk 3 8 | 9 | 10 | Asterisks loose: 11 | 12 | * asterisk 1 13 | 14 | * asterisk 2 15 | 16 | * asterisk 3 17 | 18 | * * * 19 | 20 | Pluses tight: 21 | 22 | + Plus 1 23 | + Plus 2 24 | + Plus 3 25 | 26 | 27 | Pluses loose: 28 | 29 | + Plus 1 30 | 31 | + Plus 2 32 | 33 | + Plus 3 34 | 35 | * * * 36 | 37 | 38 | Minuses tight: 39 | 40 | - Minus 1 41 | - Minus 2 42 | - Minus 3 43 | 44 | 45 | Minuses loose: 46 | 47 | - Minus 1 48 | 49 | - Minus 2 50 | 51 | - Minus 3 52 | 53 | 54 | ## Ordered 55 | 56 | Tight: 57 | 58 | 1. First 59 | 2. Second 60 | 3. Third 61 | 62 | and: 63 | 64 | 1. One 65 | 2. Two 66 | 3. Three 67 | 68 | 69 | Loose using tabs: 70 | 71 | 1. First 72 | 73 | 2. Second 74 | 75 | 3. Third 76 | 77 | and using spaces: 78 | 79 | 1. One 80 | 81 | 2. Two 82 | 83 | 3. Three 84 | 85 | Multiple paragraphs: 86 | 87 | 1. Item 1, graf one. 88 | 89 | Item 2. graf two. The quick brown fox jumped over the lazy dog's 90 | back. 91 | 92 | 2. Item 2. 93 | 94 | 3. Item 3. 95 | 96 | 97 | 98 | ## Nested 99 | 100 | * Tab 101 | * Tab 102 | * Tab 103 | 104 | Here's another: 105 | 106 | 1. First 107 | 2. Second: 108 | * Fee 109 | * Fie 110 | * Foe 111 | 3. Third 112 | 113 | Same thing but with paragraphs: 114 | 115 | 1. First 116 | 117 | 2. Second: 118 | * Fee 119 | * Fie 120 | * Foe 121 | 122 | 3. Third 123 | 124 | 125 | This was an error in Markdown 1.0.1: 126 | 127 | * this 128 | 129 | * sub 130 | 131 | that 132 | -------------------------------------------------------------------------------- /1.10/Dockerfile.rhel7: -------------------------------------------------------------------------------- 1 | FROM rhscl/s2i-base-rhel7:1 2 | 3 | ENV NAME=golang \ 4 | VERSION=1.10 5 | 6 | ENV SUMMARY="Platform for building and running Go $VERSION based applications" \ 7 | DESCRIPTION="Go $VERSION available as docker container is a base platform for \ 8 | building and running various Go $VERSION applications and frameworks. \ 9 | Go is an easy to learn, powerful, statically typed language in the C/C++ \ 10 | tradition with garbage collection, concurrent programming support, and memory safety features." 11 | 12 | LABEL summary="$SUMMARY" \ 13 | description="$DESCRIPTION" \ 14 | io.k8s.description="$DESCRIPTION" \ 15 | io.k8s.display-name="Go $VERSION" \ 16 | io.openshift.tags="builder,golang,golang18,rh-golang18,go" \ 17 | com.redhat.component="go-toolset-7-docker" \ 18 | name="devtools/go-toolset-7-rhel7" \ 19 | version="1" \ 20 | usage="docker run devtools/go-toolset-7-rhel7" 21 | 22 | RUN yum install -y yum-utils && \ 23 | yum-config-manager --disable \* &> /dev/null && \ 24 | yum-config-manager --enable rhel-7-server-devtools-rpms && \ 25 | yum-config-manager --enable rhel-7-server-rpms && \ 26 | yum-config-manager --enable rhel-7-server-optional-rpms && \ 27 | INSTALL_PKGS="go-toolset-7" && \ 28 | yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ 29 | rpm -V $INSTALL_PKGS && \ 30 | yum clean all -y 31 | 32 | # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH. 33 | COPY ./s2i/bin/ $STI_SCRIPTS_PATH 34 | 35 | COPY ./root/ / 36 | 37 | RUN chown -R 1001:0 $STI_SCRIPTS_PATH && chown -R 1001:0 $APP_ROOT 38 | 39 | USER 1001 40 | 41 | # Set the default CMD to print the usage of the language image. 42 | CMD $STI_SCRIPTS_PATH/usage 43 | -------------------------------------------------------------------------------- /1.12/s2i/bin/assemble: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd /tmp/src 6 | 7 | if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then 8 | 9 | INSTALL_URL=${INSTALL_URL:-$IMPORT_URL} 10 | 11 | if [[ ! -z "$IMPORT_URL" ]]; then 12 | 13 | popd 14 | 15 | echo "Assembling GOPATH" 16 | 17 | export GOPATH=`realpath $HOME/go` 18 | 19 | mkdir -p "$GOPATH/src/$IMPORT_URL" 20 | 21 | shopt -s dotglob 22 | mv /tmp/src/* "$GOPATH/src/$IMPORT_URL" 23 | 24 | if [[ -d "/tmp/artifacts/pkg" ]] || [[ -d "/tmp/artifacts/go-build" ]]; then 25 | 26 | echo "Restoring previous build artifacts" 27 | 28 | mv "/tmp/artifacts/pkg" "$GOPATH" 29 | GOCACHE=`go env GOCACHE` 30 | mkdir -p "$GOCACHE" 31 | mv /tmp/artifacts/go-build "$GOCACHE" 32 | 33 | fi 34 | 35 | # Resolve dependencies, ignore if vendor present 36 | 37 | if [[ ! -d "$GOPATH/src/$INSTALL_URL/vendor" ]] && [[ `go list -f {{.Incomplete}} "$INSTALL_URL"` == "true" ]]; then 38 | 39 | echo "Resolving dependencies" 40 | 41 | pushd "$GOPATH/src/$INSTALL_URL" 42 | 43 | go get 44 | 45 | popd 46 | 47 | fi 48 | 49 | # lets build 50 | 51 | pushd "$GOPATH/src/$INSTALL_URL" 52 | 53 | echo "Building" 54 | 55 | go install "$INSTALL_URL" 56 | 57 | mv "$GOPATH/bin/*" /opt/app-root/gobinary 58 | 59 | popd 60 | 61 | exit 62 | 63 | fi 64 | 65 | echo "ERROR: Package is missing dependencies and IMPORT_URL inference failed. Set IMPORT_URL env var." 66 | exec "/$STI_SCRIPTS_PATH/usage" 67 | 68 | else 69 | 70 | go build -o /opt/app-root/gobinary 71 | 72 | popd 73 | 74 | fi 75 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/doc.go: -------------------------------------------------------------------------------- 1 | // Package blackfriday is a Markdown processor. 2 | // 3 | // It translates plain text with simple formatting rules into HTML or LaTeX. 4 | // 5 | // Sanitized Anchor Names 6 | // 7 | // Blackfriday includes an algorithm for creating sanitized anchor names 8 | // corresponding to a given input text. This algorithm is used to create 9 | // anchors for headings when EXTENSION_AUTO_HEADER_IDS is enabled. The 10 | // algorithm is specified below, so that other packages can create 11 | // compatible anchor names and links to those anchors. 12 | // 13 | // The algorithm iterates over the input text, interpreted as UTF-8, 14 | // one Unicode code point (rune) at a time. All runes that are letters (category L) 15 | // or numbers (category N) are considered valid characters. They are mapped to 16 | // lower case, and included in the output. All other runes are considered 17 | // invalid characters. Invalid characters that preceed the first valid character, 18 | // as well as invalid character that follow the last valid character 19 | // are dropped completely. All other sequences of invalid characters 20 | // between two valid characters are replaced with a single dash character '-'. 21 | // 22 | // SanitizedAnchorName exposes this functionality, and can be used to 23 | // create compatible links to the anchor names generated by blackfriday. 24 | // This algorithm is also implemented in a small standalone package at 25 | // github.com/shurcooL/sanitized_anchor_name. It can be useful for clients 26 | // that want a small package and don't need full functionality of blackfriday. 27 | package blackfriday 28 | 29 | // NOTE: Keep Sanitized Anchor Name algorithm in sync with package 30 | // github.com/shurcooL/sanitized_anchor_name. 31 | // Otherwise, users of sanitized_anchor_name will get anchor names 32 | // that are incompatible with those generated by blackfriday. 33 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/markdown_test.go: -------------------------------------------------------------------------------- 1 | // 2 | // Blackfriday Markdown Processor 3 | // Available at http://github.com/russross/blackfriday 4 | // 5 | // Copyright © 2011 Russ Ross . 6 | // Distributed under the Simplified BSD License. 7 | // See README.md for details. 8 | // 9 | 10 | // 11 | // Unit tests for full document parsing and rendering 12 | // 13 | 14 | package blackfriday 15 | 16 | import ( 17 | "testing" 18 | ) 19 | 20 | func runMarkdown(input string) string { 21 | return string(MarkdownCommon([]byte(input))) 22 | } 23 | 24 | func doTests(t *testing.T, tests []string) { 25 | // catch and report panics 26 | var candidate string 27 | defer func() { 28 | if err := recover(); err != nil { 29 | t.Errorf("\npanic while processing [%#v]: %s\n", candidate, err) 30 | } 31 | }() 32 | 33 | for i := 0; i+1 < len(tests); i += 2 { 34 | input := tests[i] 35 | candidate = input 36 | expected := tests[i+1] 37 | actual := runMarkdown(candidate) 38 | if actual != expected { 39 | t.Errorf("\nInput [%#v]\nExpected[%#v]\nActual [%#v]", 40 | candidate, expected, actual) 41 | } 42 | 43 | // now test every substring to stress test bounds checking 44 | if !testing.Short() { 45 | for start := 0; start < len(input); start++ { 46 | for end := start + 1; end <= len(input); end++ { 47 | candidate = input[start:end] 48 | _ = runMarkdown(candidate) 49 | } 50 | } 51 | } 52 | } 53 | } 54 | 55 | func TestDocument(t *testing.T) { 56 | var tests = []string{ 57 | // Empty document. 58 | "", 59 | "", 60 | 61 | " ", 62 | "", 63 | 64 | // This shouldn't panic. 65 | // https://github.com/russross/blackfriday/issues/172 66 | "[]:<", 67 | "

    []:<

    \n", 68 | 69 | // This shouldn't panic. 70 | // https://github.com/russross/blackfriday/issues/173 71 | " [", 72 | "

    [

    \n", 73 | } 74 | doTests(t, tests) 75 | } 76 | -------------------------------------------------------------------------------- /1.10/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.11/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.12/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.13/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.14/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.15/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.8/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /1.9/README.md: -------------------------------------------------------------------------------- 1 | Golang s2i container image 2 | =================== 3 | 4 | This repository contains the source for building various versions of 5 | the Go application as a reproducible s2i container image. 6 | Users can choose between RHEL, Fedora and CentOS based builder images. 7 | The resulting image can be run using [podman](https://github.com/containers/libpod), [Docker](http://docker.io) or using [source-to-image](https://github.com/openshift/source-to-image/). 8 | Also the whole pipeline from build to app deployment could be run on top of the [Openshift Origin](https://www.okd.io/) or [Red Hat's Openshift](https://www.openshift.com/). 9 | 10 | 11 | Usage 12 | --------------------- 13 | 14 | Simplest usage via s2i: 15 | 16 | s2i build ./src centos/go-toolset-7-centos7:latest test-app 17 | 18 | where ./src directory contains git repository with golang application that has complete dependencies. You can't use incremental build in this case. 19 | 20 | or 21 | 22 | s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ./src centos/go-toolset-7-centos7:latest test-app 23 | 24 | where ./src directory contains git repository with golang application(in this case github.com/cpuguy83/go-md2man) that has complete or incomplete dependencies. You can use incremental build in this case. 25 | 26 | Both will build test-app application image. 27 | 28 | Environment variables 29 | --------------------- 30 | 31 | To set these environment variables, you can place them as a key value pair into a `.s2i/environment` 32 | file inside your source code repository or specified via s2i invocation. 33 | 34 | 35 | * **IMPORT_URL** 36 | 37 | Used to specify the golang application import URL (i.e. usually something like github.com/someorg/somerepo), that is build. Necessary for the incremental build to function. 38 | 39 | * **INSTALL_URL** 40 | 41 | Used to specify the golang application import URL of the main package (i.e. usually something like github.com/someorg/somerepo/subfolder). Necessary if the main package is not in the root folder of the repository. 42 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Backslash escapes.text: -------------------------------------------------------------------------------- 1 | These should all get escaped: 2 | 3 | Backslash: \\ 4 | 5 | Backtick: \` 6 | 7 | Asterisk: \* 8 | 9 | Underscore: \_ 10 | 11 | Left brace: \{ 12 | 13 | Right brace: \} 14 | 15 | Left bracket: \[ 16 | 17 | Right bracket: \] 18 | 19 | Left paren: \( 20 | 21 | Right paren: \) 22 | 23 | Greater-than: \> 24 | 25 | Hash: \# 26 | 27 | Period: \. 28 | 29 | Bang: \! 30 | 31 | Plus: \+ 32 | 33 | Minus: \- 34 | 35 | Tilde: \~ 36 | 37 | 38 | 39 | These should not, because they occur within a code block: 40 | 41 | Backslash: \\ 42 | 43 | Backtick: \` 44 | 45 | Asterisk: \* 46 | 47 | Underscore: \_ 48 | 49 | Left brace: \{ 50 | 51 | Right brace: \} 52 | 53 | Left bracket: \[ 54 | 55 | Right bracket: \] 56 | 57 | Left paren: \( 58 | 59 | Right paren: \) 60 | 61 | Greater-than: \> 62 | 63 | Hash: \# 64 | 65 | Period: \. 66 | 67 | Bang: \! 68 | 69 | Plus: \+ 70 | 71 | Minus: \- 72 | 73 | Tilde: \~ 74 | 75 | 76 | Nor should these, which occur in code spans: 77 | 78 | Backslash: `\\` 79 | 80 | Backtick: `` \` `` 81 | 82 | Asterisk: `\*` 83 | 84 | Underscore: `\_` 85 | 86 | Left brace: `\{` 87 | 88 | Right brace: `\}` 89 | 90 | Left bracket: `\[` 91 | 92 | Right bracket: `\]` 93 | 94 | Left paren: `\(` 95 | 96 | Right paren: `\)` 97 | 98 | Greater-than: `\>` 99 | 100 | Hash: `\#` 101 | 102 | Period: `\.` 103 | 104 | Bang: `\!` 105 | 106 | Plus: `\+` 107 | 108 | Minus: `\-` 109 | 110 | Tilde: `\~` 111 | 112 | 113 | These should get escaped, even though they're matching pairs for 114 | other Markdown constructs: 115 | 116 | \*asterisks\* 117 | 118 | \_underscores\_ 119 | 120 | \`backticks\` 121 | 122 | This is a code span with a literal backslash-backtick sequence: `` \` `` 123 | 124 | This is a tag with unescaped backticks bar. 125 | 126 | This is a tag with backslashes bar. 127 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/md2man/roff_test.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | ) 7 | 8 | func TestBlockCode(t *testing.T) { 9 | r := &roffRenderer{} 10 | buf := bytes.NewBuffer(nil) 11 | 12 | code := []byte("$ echo hello world\nhello world\n") 13 | r.BlockCode(buf, code, "") 14 | 15 | expected := ` 16 | .PP 17 | .RS 18 | 19 | .nf 20 | $ echo hello world 21 | hello world 22 | 23 | .fi 24 | .RE 25 | ` 26 | result := buf.String() 27 | if expected != result { 28 | t.Fatalf("got incorrect output:\nexpected:\n%v\n\ngot:\n%v", expected, result) 29 | } 30 | } 31 | 32 | func TestTableCell(t *testing.T) { 33 | r := &roffRenderer{} 34 | buf := bytes.NewBuffer(nil) 35 | cell := []byte{} 36 | 37 | r.TableCell(buf, cell, 0) 38 | expected := " " 39 | if buf.String() != expected { 40 | t.Fatal("expected %q, got %q", expected, buf.String()) 41 | } 42 | 43 | r.TableCell(buf, cell, 0) 44 | expected += "\t " 45 | if buf.String() != expected { 46 | t.Fatalf("expected %q, got %q", expected, buf.String()) 47 | } 48 | 49 | cell = []byte("*") 50 | r.TableCell(buf, cell, 0) 51 | expected += "\t*" 52 | if buf.String() != expected { 53 | t.Fatalf("expected %q, got %q", expected, buf.String()) 54 | } 55 | 56 | cell = []byte("this is a test with some really long string") 57 | r.TableCell(buf, cell, 0) 58 | expected += "\tT{\nthis is a test with some really long string\nT}" 59 | if buf.String() != expected { 60 | t.Fatalf("expected %q, got %q", expected, buf.String()) 61 | } 62 | 63 | cell = []byte("some short string") 64 | r.TableCell(buf, cell, 0) 65 | expected += "\tsome short string" 66 | if buf.String() != expected { 67 | t.Fatalf("expected %q, got %q", expected, buf.String()) 68 | } 69 | 70 | cell = []byte{} 71 | r.TableCell(buf, cell, 0) 72 | expected += "\t " 73 | if buf.String() != expected { 74 | t.Fatalf("expected %q, got %q", expected, buf.String()) 75 | } 76 | 77 | cell = []byte("*") 78 | r.TableCell(buf, cell, 0) 79 | expected += "\t*" 80 | if buf.String() != expected { 81 | t.Fatalf("expected %q, got %q", expected, buf.String()) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/md2man/roff_test.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | ) 7 | 8 | func TestBlockCode(t *testing.T) { 9 | r := &roffRenderer{} 10 | buf := bytes.NewBuffer(nil) 11 | 12 | code := []byte("$ echo hello world\nhello world\n") 13 | r.BlockCode(buf, code, "") 14 | 15 | expected := ` 16 | .PP 17 | .RS 18 | 19 | .nf 20 | $ echo hello world 21 | hello world 22 | 23 | .fi 24 | .RE 25 | ` 26 | result := buf.String() 27 | if expected != result { 28 | t.Fatalf("got incorrect output:\nexpected:\n%v\n\ngot:\n%v", expected, result) 29 | } 30 | } 31 | 32 | func TestTableCell(t *testing.T) { 33 | r := &roffRenderer{} 34 | buf := bytes.NewBuffer(nil) 35 | cell := []byte{} 36 | 37 | r.TableCell(buf, cell, 0) 38 | expected := " " 39 | if buf.String() != expected { 40 | t.Fatal("expected %q, got %q", expected, buf.String()) 41 | } 42 | 43 | r.TableCell(buf, cell, 0) 44 | expected += "\t " 45 | if buf.String() != expected { 46 | t.Fatalf("expected %q, got %q", expected, buf.String()) 47 | } 48 | 49 | cell = []byte("*") 50 | r.TableCell(buf, cell, 0) 51 | expected += "\t*" 52 | if buf.String() != expected { 53 | t.Fatalf("expected %q, got %q", expected, buf.String()) 54 | } 55 | 56 | cell = []byte("this is a test with some really long string") 57 | r.TableCell(buf, cell, 0) 58 | expected += "\tT{\nthis is a test with some really long string\nT}" 59 | if buf.String() != expected { 60 | t.Fatalf("expected %q, got %q", expected, buf.String()) 61 | } 62 | 63 | cell = []byte("some short string") 64 | r.TableCell(buf, cell, 0) 65 | expected += "\tsome short string" 66 | if buf.String() != expected { 67 | t.Fatalf("expected %q, got %q", expected, buf.String()) 68 | } 69 | 70 | cell = []byte{} 71 | r.TableCell(buf, cell, 0) 72 | expected += "\t " 73 | if buf.String() != expected { 74 | t.Fatalf("expected %q, got %q", expected, buf.String()) 75 | } 76 | 77 | cell = []byte("*") 78 | r.TableCell(buf, cell, 0) 79 | expected += "\t*" 80 | if buf.String() != expected { 81 | t.Fatalf("expected %q, got %q", expected, buf.String()) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Backslash escapes.html: -------------------------------------------------------------------------------- 1 |

    These should all get escaped:

    2 | 3 |

    Backslash: \

    4 | 5 |

    Backtick: `

    6 | 7 |

    Asterisk: *

    8 | 9 |

    Underscore: _

    10 | 11 |

    Left brace: {

    12 | 13 |

    Right brace: }

    14 | 15 |

    Left bracket: [

    16 | 17 |

    Right bracket: ]

    18 | 19 |

    Left paren: (

    20 | 21 |

    Right paren: )

    22 | 23 |

    Greater-than: >

    24 | 25 |

    Hash: #

    26 | 27 |

    Period: .

    28 | 29 |

    Bang: !

    30 | 31 |

    Plus: +

    32 | 33 |

    Minus: -

    34 | 35 |

    Tilde: ~

    36 | 37 |

    These should not, because they occur within a code block:

    38 | 39 |
    Backslash: \\
     40 | 
     41 | Backtick: \`
     42 | 
     43 | Asterisk: \*
     44 | 
     45 | Underscore: \_
     46 | 
     47 | Left brace: \{
     48 | 
     49 | Right brace: \}
     50 | 
     51 | Left bracket: \[
     52 | 
     53 | Right bracket: \]
     54 | 
     55 | Left paren: \(
     56 | 
     57 | Right paren: \)
     58 | 
     59 | Greater-than: \>
     60 | 
     61 | Hash: \#
     62 | 
     63 | Period: \.
     64 | 
     65 | Bang: \!
     66 | 
     67 | Plus: \+
     68 | 
     69 | Minus: \-
     70 | 
     71 | Tilde: \~
     72 | 
    73 | 74 |

    Nor should these, which occur in code spans:

    75 | 76 |

    Backslash: \\

    77 | 78 |

    Backtick: \`

    79 | 80 |

    Asterisk: \*

    81 | 82 |

    Underscore: \_

    83 | 84 |

    Left brace: \{

    85 | 86 |

    Right brace: \}

    87 | 88 |

    Left bracket: \[

    89 | 90 |

    Right bracket: \]

    91 | 92 |

    Left paren: \(

    93 | 94 |

    Right paren: \)

    95 | 96 |

    Greater-than: \>

    97 | 98 |

    Hash: \#

    99 | 100 |

    Period: \.

    101 | 102 |

    Bang: \!

    103 | 104 |

    Plus: \+

    105 | 106 |

    Minus: \-

    107 | 108 |

    Tilde: \~

    109 | 110 |

    These should get escaped, even though they're matching pairs for 111 | other Markdown constructs:

    112 | 113 |

    *asterisks*

    114 | 115 |

    _underscores_

    116 | 117 |

    `backticks`

    118 | 119 |

    This is a code span with a literal backslash-backtick sequence: \`

    120 | 121 |

    This is a tag with unescaped backticks bar.

    122 | 123 |

    This is a tag with backslashes bar.

    124 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Ordered and unordered lists.html: -------------------------------------------------------------------------------- 1 |

    Unordered

    2 | 3 |

    Asterisks tight:

    4 | 5 |
      6 |
    • asterisk 1
    • 7 |
    • asterisk 2
    • 8 |
    • asterisk 3
    • 9 |
    10 | 11 |

    Asterisks loose:

    12 | 13 |
      14 |
    • asterisk 1

    • 15 | 16 |
    • asterisk 2

    • 17 | 18 |
    • asterisk 3

    • 19 |
    20 | 21 |
    22 | 23 |

    Pluses tight:

    24 | 25 |
      26 |
    • Plus 1
    • 27 |
    • Plus 2
    • 28 |
    • Plus 3
    • 29 |
    30 | 31 |

    Pluses loose:

    32 | 33 |
      34 |
    • Plus 1

    • 35 | 36 |
    • Plus 2

    • 37 | 38 |
    • Plus 3

    • 39 |
    40 | 41 |
    42 | 43 |

    Minuses tight:

    44 | 45 |
      46 |
    • Minus 1
    • 47 |
    • Minus 2
    • 48 |
    • Minus 3
    • 49 |
    50 | 51 |

    Minuses loose:

    52 | 53 |
      54 |
    • Minus 1

    • 55 | 56 |
    • Minus 2

    • 57 | 58 |
    • Minus 3

    • 59 |
    60 | 61 |

    Ordered

    62 | 63 |

    Tight:

    64 | 65 |
      66 |
    1. First
    2. 67 |
    3. Second
    4. 68 |
    5. Third
    6. 69 |
    70 | 71 |

    and:

    72 | 73 |
      74 |
    1. One
    2. 75 |
    3. Two
    4. 76 |
    5. Three
    6. 77 |
    78 | 79 |

    Loose using tabs:

    80 | 81 |
      82 |
    1. First

    2. 83 | 84 |
    3. Second

    4. 85 | 86 |
    5. Third

    6. 87 |
    88 | 89 |

    and using spaces:

    90 | 91 |
      92 |
    1. One

    2. 93 | 94 |
    3. Two

    4. 95 | 96 |
    5. Three

    6. 97 |
    98 | 99 |

    Multiple paragraphs:

    100 | 101 |
      102 |
    1. Item 1, graf one.

      103 | 104 |

      Item 2. graf two. The quick brown fox jumped over the lazy dog's 105 | back.

    2. 106 | 107 |
    3. Item 2.

    4. 108 | 109 |
    5. Item 3.

    6. 110 |
    111 | 112 |

    Nested

    113 | 114 |
      115 |
    • Tab 116 | 117 |
        118 |
      • Tab 119 | 120 |
          121 |
        • Tab
        • 122 |
      • 123 |
    • 124 |
    125 | 126 |

    Here's another:

    127 | 128 |
      129 |
    1. First
    2. 130 |
    3. Second: 131 | 132 |
        133 |
      • Fee
      • 134 |
      • Fie
      • 135 |
      • Foe
      • 136 |
    4. 137 |
    5. Third
    6. 138 |
    139 | 140 |

    Same thing but with paragraphs:

    141 | 142 |
      143 |
    1. First

    2. 144 | 145 |
    3. Second:

      146 | 147 |
        148 |
      • Fee
      • 149 |
      • Fie
      • 150 |
      • Foe
      • 151 |
    4. 152 | 153 |
    5. Third

    6. 154 |
    155 | 156 |

    This was an error in Markdown 1.0.1:

    157 | 158 |
      159 |
    • this

      160 | 161 |
        162 |
      • sub
      • 163 |
      164 | 165 |

      that

    • 166 |
    167 | -------------------------------------------------------------------------------- /imagestreams/golang-rhel-aarch64.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "annotations": { 6 | "openshift.io/display-name": "Go" 7 | }, 8 | "name": "golang" 9 | }, 10 | "spec": { 11 | "tags": [ 12 | { 13 | "annotations": { 14 | "description": "Build and run Go applications on UBI. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.\n\nWARNING: By selecting this tag, your application will automatically update to use the latest version of Go available on OpenShift, including major version updates.", 15 | "iconClass": "icon-go-gopher", 16 | "openshift.io/display-name": "Go (Latest)", 17 | "openshift.io/provider-display-name": "Red Hat, Inc.", 18 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 19 | "supports": "golang", 20 | "tags": "builder,golang,go" 21 | }, 22 | "from": { 23 | "kind": "ImageStreamTag", 24 | "name": "1.18-ubi8" 25 | }, 26 | "name": "latest", 27 | "referencePolicy": { 28 | "type": "Local" 29 | } 30 | }, 31 | { 32 | "annotations": { 33 | "description": "Build and run Go applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 34 | "iconClass": "icon-go-gopher", 35 | "openshift.io/display-name": "Go 1.18 (UBI 9)", 36 | "openshift.io/provider-display-name": "Red Hat, Inc.", 37 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 38 | "supports": "golang", 39 | "tags": "builder,golang,go" 40 | }, 41 | "from": { 42 | "kind": "DockerImage", 43 | "name": "registry.redhat.io/ubi9/go-toolset:1.18" 44 | }, 45 | "name": "1.18-ubi9", 46 | "referencePolicy": { 47 | "type": "Local" 48 | } 49 | }, 50 | { 51 | "annotations": { 52 | "description": "Build and run Go applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 53 | "iconClass": "icon-go-gopher", 54 | "openshift.io/display-name": "Go 1.18 (UBI 8)", 55 | "openshift.io/provider-display-name": "Red Hat, Inc.", 56 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 57 | "supports": "golang", 58 | "tags": "builder,golang,go" 59 | }, 60 | "from": { 61 | "kind": "DockerImage", 62 | "name": "registry.redhat.io/ubi8/go-toolset:1.18" 63 | }, 64 | "name": "1.18-ubi8", 65 | "referencePolicy": { 66 | "type": "Local" 67 | } 68 | } 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/ref_test.go: -------------------------------------------------------------------------------- 1 | // 2 | // Blackfriday Markdown Processor 3 | // Available at http://github.com/russross/blackfriday 4 | // 5 | // Copyright © 2011 Russ Ross . 6 | // Distributed under the Simplified BSD License. 7 | // See README.md for details. 8 | // 9 | 10 | // 11 | // Markdown 1.0.3 reference tests 12 | // 13 | 14 | package blackfriday 15 | 16 | import ( 17 | "io/ioutil" 18 | "path/filepath" 19 | "testing" 20 | ) 21 | 22 | func runMarkdownReference(input string, flag int) string { 23 | renderer := HtmlRenderer(0, "", "") 24 | return string(Markdown([]byte(input), renderer, flag)) 25 | } 26 | 27 | func doTestsReference(t *testing.T, files []string, flag int) { 28 | // catch and report panics 29 | var candidate string 30 | defer func() { 31 | if err := recover(); err != nil { 32 | t.Errorf("\npanic while processing [%#v]: %s\n", candidate, err) 33 | } 34 | }() 35 | 36 | for _, basename := range files { 37 | filename := filepath.Join("testdata", basename+".text") 38 | inputBytes, err := ioutil.ReadFile(filename) 39 | if err != nil { 40 | t.Errorf("Couldn't open '%s', error: %v\n", filename, err) 41 | continue 42 | } 43 | input := string(inputBytes) 44 | 45 | filename = filepath.Join("testdata", basename+".html") 46 | expectedBytes, err := ioutil.ReadFile(filename) 47 | if err != nil { 48 | t.Errorf("Couldn't open '%s', error: %v\n", filename, err) 49 | continue 50 | } 51 | expected := string(expectedBytes) 52 | 53 | // fmt.Fprintf(os.Stderr, "processing %s ...", filename) 54 | actual := string(runMarkdownReference(input, flag)) 55 | if actual != expected { 56 | t.Errorf("\n [%#v]\nExpected[%#v]\nActual [%#v]", 57 | basename+".text", expected, actual) 58 | } 59 | // fmt.Fprintf(os.Stderr, " ok\n") 60 | 61 | // now test every prefix of every input to check for 62 | // bounds checking 63 | if !testing.Short() { 64 | start, max := 0, len(input) 65 | for end := start + 1; end <= max; end++ { 66 | candidate = input[start:end] 67 | // fmt.Fprintf(os.Stderr, " %s %d:%d/%d\n", filename, start, end, max) 68 | _ = runMarkdownReference(candidate, flag) 69 | } 70 | } 71 | } 72 | } 73 | 74 | func TestReference(t *testing.T) { 75 | files := []string{ 76 | "Amps and angle encoding", 77 | "Auto links", 78 | "Backslash escapes", 79 | "Blockquotes with code blocks", 80 | "Code Blocks", 81 | "Code Spans", 82 | "Hard-wrapped paragraphs with list-like lines", 83 | "Horizontal rules", 84 | "Inline HTML (Advanced)", 85 | "Inline HTML (Simple)", 86 | "Inline HTML comments", 87 | "Links, inline style", 88 | "Links, reference style", 89 | "Links, shortcut references", 90 | "Literal quotes in titles", 91 | "Markdown Documentation - Basics", 92 | "Markdown Documentation - Syntax", 93 | "Nested blockquotes", 94 | "Ordered and unordered lists", 95 | "Strong and em together", 96 | "Tabs", 97 | "Tidyness", 98 | } 99 | doTestsReference(t, files, 0) 100 | } 101 | 102 | func TestReference_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { 103 | files := []string{ 104 | "Amps and angle encoding", 105 | "Auto links", 106 | "Backslash escapes", 107 | "Blockquotes with code blocks", 108 | "Code Blocks", 109 | "Code Spans", 110 | "Hard-wrapped paragraphs with list-like lines no empty line before block", 111 | "Horizontal rules", 112 | "Inline HTML (Advanced)", 113 | "Inline HTML (Simple)", 114 | "Inline HTML comments", 115 | "Links, inline style", 116 | "Links, reference style", 117 | "Links, shortcut references", 118 | "Literal quotes in titles", 119 | "Markdown Documentation - Basics", 120 | "Markdown Documentation - Syntax", 121 | "Nested blockquotes", 122 | "Ordered and unordered lists", 123 | "Strong and em together", 124 | "Tabs", 125 | "Tidyness", 126 | } 127 | doTestsReference(t, files, EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK) 128 | } 129 | -------------------------------------------------------------------------------- /imagestreams/golang-rhel.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "annotations": { 6 | "openshift.io/display-name": "Go" 7 | }, 8 | "name": "golang" 9 | }, 10 | "spec": { 11 | "tags": [ 12 | { 13 | "annotations": { 14 | "description": "Build and run Go applications on UBI. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.\n\nWARNING: By selecting this tag, your application will automatically update to use the latest version of Go available on OpenShift, including major version updates.", 15 | "iconClass": "icon-go-gopher", 16 | "openshift.io/display-name": "Go (Latest)", 17 | "openshift.io/provider-display-name": "Red Hat, Inc.", 18 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 19 | "supports": "golang", 20 | "tags": "builder,golang,go" 21 | }, 22 | "from": { 23 | "kind": "ImageStreamTag", 24 | "name": "1.18-ubi8" 25 | }, 26 | "name": "latest", 27 | "referencePolicy": { 28 | "type": "Local" 29 | } 30 | }, 31 | { 32 | "annotations": { 33 | "description": "Build and run Go applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 34 | "iconClass": "icon-go-gopher", 35 | "openshift.io/display-name": "Go 1.18 (UBI 9)", 36 | "openshift.io/provider-display-name": "Red Hat, Inc.", 37 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 38 | "supports": "golang", 39 | "tags": "builder,golang,go" 40 | }, 41 | "from": { 42 | "kind": "DockerImage", 43 | "name": "registry.redhat.io/ubi9/go-toolset:1.18" 44 | }, 45 | "name": "1.18-ubi9", 46 | "referencePolicy": { 47 | "type": "Local" 48 | } 49 | }, 50 | { 51 | "annotations": { 52 | "description": "Build and run Go applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 53 | "iconClass": "icon-go-gopher", 54 | "openshift.io/display-name": "Go 1.18 (UBI 8)", 55 | "openshift.io/provider-display-name": "Red Hat, Inc.", 56 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 57 | "supports": "golang", 58 | "tags": "builder,golang,go" 59 | }, 60 | "from": { 61 | "kind": "DockerImage", 62 | "name": "registry.redhat.io/ubi8/go-toolset:1.18" 63 | }, 64 | "name": "1.18-ubi8", 65 | "referencePolicy": { 66 | "type": "Local" 67 | } 68 | }, 69 | { 70 | "annotations": { 71 | "description": "Build and run Go applications on UBI 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 72 | "iconClass": "icon-go-gopher", 73 | "openshift.io/display-name": "Go 1.18 (UBI 7)", 74 | "openshift.io/provider-display-name": "Red Hat, Inc.", 75 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 76 | "supports": "golang", 77 | "tags": "builder,golang,go" 78 | }, 79 | "from": { 80 | "kind": "DockerImage", 81 | "name": "registry.redhat.io/ubi7/go-toolset:1.18" 82 | }, 83 | "name": "1.18-ubi7", 84 | "referencePolicy": { 85 | "type": "Local" 86 | } 87 | } 88 | ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /imagestreams/golang-centos.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "image.openshift.io/v1", 3 | "kind": "ImageStream", 4 | "metadata": { 5 | "annotations": { 6 | "openshift.io/display-name": "Go" 7 | }, 8 | "name": "golang" 9 | }, 10 | "spec": { 11 | "tags": [ 12 | { 13 | "annotations": { 14 | "description": "Build and run Go applications on UBI. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.\n\nWARNING: By selecting this tag, your application will automatically update to use the latest version of Go available on OpenShift, including major versions updates.", 15 | "iconClass": "icon-go-gopher", 16 | "openshift.io/display-name": "Go (Latest)", 17 | "openshift.io/provider-display-name": "Red Hat, Inc.", 18 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 19 | "supports": "golang", 20 | "tags": "builder,golang,go" 21 | }, 22 | "from": { 23 | "kind": "ImageStreamTag", 24 | "name": "1.18-ubi8" 25 | }, 26 | "name": "latest", 27 | "referencePolicy": { 28 | "type": "Local" 29 | } 30 | }, 31 | { 32 | "annotations": { 33 | "description": "Build and run Go applications on UBI 9. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 34 | "iconClass": "icon-go-gopher", 35 | "openshift.io/display-name": "Go 1.18 (UBI 9)", 36 | "openshift.io/provider-display-name": "Red Hat, Inc.", 37 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 38 | "supports": "golang", 39 | "tags": "builder,golang,go" 40 | }, 41 | "from": { 42 | "kind": "DockerImage", 43 | "name": "registry.access.redhat.com/ubi9/go-toolset:1.18" 44 | }, 45 | "name": "1.18-ubi9", 46 | "referencePolicy": { 47 | "type": "Local" 48 | } 49 | }, 50 | { 51 | "annotations": { 52 | "description": "Build and run Go applications on UBI 8. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 53 | "iconClass": "icon-go-gopher", 54 | "openshift.io/display-name": "Go 1.18 (UBI 8)", 55 | "openshift.io/provider-display-name": "Red Hat, Inc.", 56 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 57 | "supports": "golang", 58 | "tags": "builder,golang,go" 59 | }, 60 | "from": { 61 | "kind": "DockerImage", 62 | "name": "registry.access.redhat.com/ubi8/go-toolset:1.18" 63 | }, 64 | "name": "1.18-ubi8", 65 | "referencePolicy": { 66 | "type": "Local" 67 | } 68 | }, 69 | { 70 | "annotations": { 71 | "description": "Build and run Go applications on UBI 7. For more information about using this builder image, including OpenShift considerations, see https://github.com/sclorg/golang-container/blob/master/README.md.", 72 | "iconClass": "icon-go-gopher", 73 | "openshift.io/display-name": "Go 1.18 (UBI 7)", 74 | "openshift.io/provider-display-name": "Red Hat, Inc.", 75 | "sampleRepo": "https://github.com/sclorg/golang-ex.git", 76 | "supports": "golang", 77 | "tags": "builder,golang,go" 78 | }, 79 | "from": { 80 | "kind": "DockerImage", 81 | "name": "registry.access.redhat.com/ubi7/go-toolset:1.18" 82 | }, 83 | "name": "1.18-ubi7", 84 | "referencePolicy": { 85 | "type": "Local" 86 | } 87 | } 88 | ] 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /test/run: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # The 'run' performs a simple test that verifies that S2I image. 4 | # The main focus here is to excersise the S2I scripts. 5 | # 6 | # IMAGE_NAME specifies a name of the candidate image used for testing. 7 | # The image has to be available before this script is executed. 8 | # 9 | export IMAGE_NAME=${IMAGE_NAME:-centos/go-toolset-7-centos7} 10 | 11 | declare -a TEST_APPS=({simple,import-with-vendor,import-without-vendor,complete}-app) 12 | 13 | # TODO: Make command compatible for Mac users 14 | test_dir="$(readlink -zf $(dirname "${BASH_SOURCE[0]}"))" 15 | image_dir=$(readlink -zf ${test_dir}/..) 16 | 17 | info() { 18 | echo -e "\n\e[1m[INFO] $@\e[0m\n" 19 | } 20 | 21 | image_exists() { 22 | docker inspect $1 &>/dev/null 23 | } 24 | 25 | container_exists() { 26 | image_exists $(cat $cid_file) 27 | } 28 | 29 | container_ip() { 30 | docker inspect --format="{{ .NetworkSettings.IPAddress }}" $(cat $cid_file) 31 | } 32 | 33 | run_s2i_build() { 34 | info "Building the ${1} application image ..." 35 | pushd ${test_dir}/${1} >/dev/null 36 | ./s2i-build 37 | popd 38 | } 39 | 40 | incremental_test_clean_up(){ 41 | rm -f run1 42 | rm -f run2 43 | } 44 | 45 | run_s2i_build_incremental(){ 46 | info "Building the ${1} application image using incremental build ..." 47 | 48 | pushd ${test_dir}/${1} >/dev/null 49 | ./s2i-build-incremental &>run1 50 | ./s2i-build-incremental &>run2 51 | if grep "Clean build will be performed because of error saving previous build artifacts" run2; then 52 | cat run2 53 | info "Incremental build, artifact injection failed..." 54 | exit 1 55 | fi 56 | if ! grep "Restoring previous build artifacts" run2; then 57 | info "Incremental build, artifact restoration failed..." 58 | info "s2i invocation outputs" 59 | cat run1 60 | echo "------" 61 | cat run2 62 | exit 1 63 | fi 64 | 65 | incremental_test_clean_up 66 | 67 | popd 68 | } 69 | 70 | prepare() { 71 | if ! image_exists ${IMAGE_NAME}; then 72 | echo "ERROR: The image ${IMAGE_NAME} must exist before this script is executed." 73 | exit 1 74 | fi 75 | # TODO: S2I build require the application is a valid 'GIT' repository, we 76 | # should remove this restriction in the future when a file:// is used. 77 | info "Preparing to test ${1} ..." 78 | pushd ${test_dir}/${1}/app >/dev/null 79 | git init 80 | git config user.email "build@localhost" && git config user.name "builder" 81 | git add -A && git commit -m "Sample commit" 82 | popd >/dev/null 83 | } 84 | 85 | run_test_application() { 86 | docker run -t --user=100001 ${CONTAINER_ARGS} --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp 87 | } 88 | 89 | cleanup_app() { 90 | info "Cleaning up app container ..." 91 | if [ -f $cid_file ]; then 92 | if container_exists; then 93 | docker stop $(cat $cid_file) 94 | fi 95 | fi 96 | } 97 | 98 | cleanup() { 99 | info "Cleaning up the test application image" 100 | if image_exists ${IMAGE_NAME}-testapp; then 101 | docker rmi -f ${IMAGE_NAME}-testapp 102 | fi 103 | info "Cleaning up the test repository" 104 | if [ -d ${test_dir}/${1}/app/.git ]; then 105 | rm -rf ${test_dir}/${1}/app/.git 106 | fi 107 | } 108 | 109 | check_result() { 110 | local result="$1" 111 | if [[ "$result" != "0" ]]; then 112 | info "TEST FAILED (${result})" 113 | cleanup 114 | exit $result 115 | fi 116 | } 117 | 118 | wait_for_cid() { 119 | local max_attempts=10 120 | local sleep_time=1 121 | local attempt=1 122 | local result=1 123 | info "Waiting for application container to start $CONTAINER_ARGS ..." 124 | while [ $attempt -le $max_attempts ]; do 125 | [ -f $cid_file ] && [ -s $cid_file ] && break 126 | attempt=$(( $attempt + 1 )) 127 | sleep $sleep_time 128 | done 129 | } 130 | 131 | test_s2i_usage() { 132 | info "Testing 's2i usage' ..." 133 | s2i usage ${s2i_args} ${IMAGE_NAME} 134 | } 135 | 136 | test_docker_run_usage() { 137 | info "Testing 'docker run' usage ..." 138 | docker run ${IMAGE_NAME} 139 | } 140 | 141 | test_scl_usage() { 142 | local run_cmd="$1" 143 | local expected="$2" 144 | local cid_file="$3" 145 | 146 | info "Testing the image SCL enable" 147 | out=$(docker run -t --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}" 2>&1) 148 | if ! echo "${out}" | grep -q "${expected}"; then 149 | echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" 150 | return 1 151 | fi 152 | out=$(docker exec $(cat ${cid_file}) /bin/bash -c "${run_cmd}" 2>&1) 153 | if ! echo "${out}" | grep -q "${expected}"; then 154 | echo "ERROR[exec /bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" 155 | return 1 156 | fi 157 | out=$(docker exec $(cat ${cid_file}) /bin/sh -ic "${run_cmd}" 2>&1) 158 | if ! echo "${out}" | grep -q "${expected}"; then 159 | echo "ERROR[exec /bin/sh -ic "${run_cmd}"] Expected '${expected}', got '${out}'" 160 | return 1 161 | fi 162 | } 163 | 164 | test_application() { 165 | local cid_file=$(mktemp -u --suffix=.cid) 166 | # Verify that the HTTP connection can be established to test application container 167 | run_test_application & 168 | 169 | # Wait for the container to write it's CID file 170 | wait_for_cid 171 | 172 | test_scl_usage "go version" "${EXPECTED_VER}" "${cid_file}" 173 | check_result $? 174 | cleanup_app 175 | } 176 | 177 | 178 | # Since we built the candidate image locally, we don't want S2I attempt to pull 179 | # it from Docker hub 180 | export s2i_args="-p never --incremental-pull-policy=never" 181 | 182 | # determine what version of the Go are we testing base on the dir we are in 183 | export EXPECTED_VER="go`pwd | awk -F "/" '{print $(NF)}'`" 184 | 185 | # Verify the 'usage' script is working properly when running the base image with 's2i usage ...' 186 | info "Testing image ${IMAGE_NAME} with go version ${EXPECTED_VER} " 187 | test_s2i_usage 188 | check_result $? 189 | 190 | # Verify the 'usage' script is working properly when running the base image with 'docker run ...' 191 | test_docker_run_usage 192 | check_result $? 193 | 194 | for app in ${TEST_APPS[@]}; do 195 | prepare ${app} 196 | run_s2i_build ${app} 197 | if [ -e ${test_dir}/${app}/s2i-build-incremental ]; then 198 | run_s2i_build_incremental ${app} 199 | fi 200 | check_result $? 201 | 202 | # test application with default user 203 | test_application 204 | 205 | # test application with random user 206 | CONTAINER_ARGS="-u 12345" test_application 207 | 208 | info "All tests for the ${app} finished successfully." 209 | cleanup ${app} 210 | done 211 | 212 | info "All tests finished successfully." 213 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/md2man/roff.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "html" 7 | "strings" 8 | 9 | "github.com/russross/blackfriday" 10 | ) 11 | 12 | type roffRenderer struct{} 13 | 14 | var listCounter int 15 | 16 | func RoffRenderer(flags int) blackfriday.Renderer { 17 | return &roffRenderer{} 18 | } 19 | 20 | func (r *roffRenderer) GetFlags() int { 21 | return 0 22 | } 23 | 24 | func (r *roffRenderer) TitleBlock(out *bytes.Buffer, text []byte) { 25 | out.WriteString(".TH ") 26 | 27 | splitText := bytes.Split(text, []byte("\n")) 28 | for i, line := range splitText { 29 | line = bytes.TrimPrefix(line, []byte("% ")) 30 | if i == 0 { 31 | line = bytes.Replace(line, []byte("("), []byte("\" \""), 1) 32 | line = bytes.Replace(line, []byte(")"), []byte("\" \""), 1) 33 | } 34 | line = append([]byte("\""), line...) 35 | line = append(line, []byte("\" ")...) 36 | out.Write(line) 37 | } 38 | out.WriteString("\n") 39 | 40 | // disable hyphenation 41 | out.WriteString(".nh\n") 42 | // disable justification (adjust text to left margin only) 43 | out.WriteString(".ad l\n") 44 | } 45 | 46 | func (r *roffRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) { 47 | out.WriteString("\n.PP\n.RS\n\n.nf\n") 48 | escapeSpecialChars(out, text) 49 | out.WriteString("\n.fi\n.RE\n") 50 | } 51 | 52 | func (r *roffRenderer) BlockQuote(out *bytes.Buffer, text []byte) { 53 | out.WriteString("\n.PP\n.RS\n") 54 | out.Write(text) 55 | out.WriteString("\n.RE\n") 56 | } 57 | 58 | func (r *roffRenderer) BlockHtml(out *bytes.Buffer, text []byte) { 59 | out.Write(text) 60 | } 61 | 62 | func (r *roffRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) { 63 | marker := out.Len() 64 | 65 | switch { 66 | case marker == 0: 67 | // This is the doc header 68 | out.WriteString(".TH ") 69 | case level == 1: 70 | out.WriteString("\n\n.SH ") 71 | case level == 2: 72 | out.WriteString("\n.SH ") 73 | default: 74 | out.WriteString("\n.SS ") 75 | } 76 | 77 | if !text() { 78 | out.Truncate(marker) 79 | return 80 | } 81 | } 82 | 83 | func (r *roffRenderer) HRule(out *bytes.Buffer) { 84 | out.WriteString("\n.ti 0\n\\l'\\n(.lu'\n") 85 | } 86 | 87 | func (r *roffRenderer) List(out *bytes.Buffer, text func() bool, flags int) { 88 | marker := out.Len() 89 | if flags&blackfriday.LIST_TYPE_ORDERED != 0 { 90 | listCounter = 1 91 | } 92 | if !text() { 93 | out.Truncate(marker) 94 | return 95 | } 96 | } 97 | 98 | func (r *roffRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) { 99 | if flags&blackfriday.LIST_TYPE_ORDERED != 0 { 100 | out.WriteString(fmt.Sprintf(".IP \"%3d.\" 5\n", listCounter)) 101 | listCounter += 1 102 | } else { 103 | out.WriteString(".IP \\(bu 2\n") 104 | } 105 | out.Write(text) 106 | out.WriteString("\n") 107 | } 108 | 109 | func (r *roffRenderer) Paragraph(out *bytes.Buffer, text func() bool) { 110 | marker := out.Len() 111 | out.WriteString("\n.PP\n") 112 | if !text() { 113 | out.Truncate(marker) 114 | return 115 | } 116 | if marker != 0 { 117 | out.WriteString("\n") 118 | } 119 | } 120 | 121 | func (r *roffRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) { 122 | out.WriteString("\n.TS\nallbox;\n") 123 | 124 | max_delims := 0 125 | lines := strings.Split(strings.TrimRight(string(header), "\n")+"\n"+strings.TrimRight(string(body), "\n"), "\n") 126 | for _, w := range lines { 127 | cur_delims := strings.Count(w, "\t") 128 | if cur_delims > max_delims { 129 | max_delims = cur_delims 130 | } 131 | } 132 | out.Write([]byte(strings.Repeat("l ", max_delims+1) + "\n")) 133 | out.Write([]byte(strings.Repeat("l ", max_delims+1) + ".\n")) 134 | out.Write(header) 135 | if len(header) > 0 { 136 | out.Write([]byte("\n")) 137 | } 138 | 139 | out.Write(body) 140 | out.WriteString("\n.TE\n") 141 | } 142 | 143 | func (r *roffRenderer) TableRow(out *bytes.Buffer, text []byte) { 144 | if out.Len() > 0 { 145 | out.WriteString("\n") 146 | } 147 | out.Write(text) 148 | } 149 | 150 | func (r *roffRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, align int) { 151 | if out.Len() > 0 { 152 | out.WriteString("\t") 153 | } 154 | if len(text) == 0 { 155 | text = []byte{' '} 156 | } 157 | out.Write([]byte("\\fB\\fC" + string(text) + "\\fR")) 158 | } 159 | 160 | func (r *roffRenderer) TableCell(out *bytes.Buffer, text []byte, align int) { 161 | if out.Len() > 0 { 162 | out.WriteString("\t") 163 | } 164 | if len(text) > 30 { 165 | text = append([]byte("T{\n"), text...) 166 | text = append(text, []byte("\nT}")...) 167 | } 168 | if len(text) == 0 { 169 | text = []byte{' '} 170 | } 171 | out.Write(text) 172 | } 173 | 174 | func (r *roffRenderer) Footnotes(out *bytes.Buffer, text func() bool) { 175 | 176 | } 177 | 178 | func (r *roffRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) { 179 | 180 | } 181 | 182 | func (r *roffRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) { 183 | out.WriteString("\n\\[la]") 184 | out.Write(link) 185 | out.WriteString("\\[ra]") 186 | } 187 | 188 | func (r *roffRenderer) CodeSpan(out *bytes.Buffer, text []byte) { 189 | out.WriteString("\\fB\\fC") 190 | escapeSpecialChars(out, text) 191 | out.WriteString("\\fR") 192 | } 193 | 194 | func (r *roffRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) { 195 | out.WriteString("\\fB") 196 | out.Write(text) 197 | out.WriteString("\\fP") 198 | } 199 | 200 | func (r *roffRenderer) Emphasis(out *bytes.Buffer, text []byte) { 201 | out.WriteString("\\fI") 202 | out.Write(text) 203 | out.WriteString("\\fP") 204 | } 205 | 206 | func (r *roffRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { 207 | } 208 | 209 | func (r *roffRenderer) LineBreak(out *bytes.Buffer) { 210 | out.WriteString("\n.br\n") 211 | } 212 | 213 | func (r *roffRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { 214 | out.Write(content) 215 | r.AutoLink(out, link, 0) 216 | } 217 | 218 | func (r *roffRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) { 219 | out.Write(tag) 220 | } 221 | 222 | func (r *roffRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) { 223 | out.WriteString("\\s+2") 224 | out.Write(text) 225 | out.WriteString("\\s-2") 226 | } 227 | 228 | func (r *roffRenderer) StrikeThrough(out *bytes.Buffer, text []byte) { 229 | } 230 | 231 | func (r *roffRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { 232 | 233 | } 234 | 235 | func (r *roffRenderer) Entity(out *bytes.Buffer, entity []byte) { 236 | out.WriteString(html.UnescapeString(string(entity))) 237 | } 238 | 239 | func processFooterText(text []byte) []byte { 240 | text = bytes.TrimPrefix(text, []byte("% ")) 241 | newText := []byte{} 242 | textArr := strings.Split(string(text), ") ") 243 | 244 | for i, w := range textArr { 245 | if i == 0 { 246 | w = strings.Replace(w, "(", "\" \"", 1) 247 | w = fmt.Sprintf("\"%s\"", w) 248 | } else { 249 | w = fmt.Sprintf(" \"%s\"", w) 250 | } 251 | newText = append(newText, []byte(w)...) 252 | } 253 | newText = append(newText, []byte(" \"\"")...) 254 | 255 | return newText 256 | } 257 | 258 | func (r *roffRenderer) NormalText(out *bytes.Buffer, text []byte) { 259 | escapeSpecialChars(out, text) 260 | } 261 | 262 | func (r *roffRenderer) DocumentHeader(out *bytes.Buffer) { 263 | } 264 | 265 | func (r *roffRenderer) DocumentFooter(out *bytes.Buffer) { 266 | } 267 | 268 | func needsBackslash(c byte) bool { 269 | for _, r := range []byte("-_&\\~") { 270 | if c == r { 271 | return true 272 | } 273 | } 274 | return false 275 | } 276 | 277 | func escapeSpecialChars(out *bytes.Buffer, text []byte) { 278 | for i := 0; i < len(text); i++ { 279 | // escape initial apostrophe or period 280 | if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') { 281 | out.WriteString("\\&") 282 | } 283 | 284 | // directly copy normal characters 285 | org := i 286 | 287 | for i < len(text) && !needsBackslash(text[i]) { 288 | i++ 289 | } 290 | if i > org { 291 | out.Write(text[org:i]) 292 | } 293 | 294 | // escape a character 295 | if i >= len(text) { 296 | break 297 | } 298 | out.WriteByte('\\') 299 | out.WriteByte(text[i]) 300 | } 301 | } 302 | -------------------------------------------------------------------------------- /test/import-without-vendor-app/app/md2man/roff.go: -------------------------------------------------------------------------------- 1 | package md2man 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "html" 7 | "strings" 8 | 9 | "github.com/russross/blackfriday" 10 | ) 11 | 12 | type roffRenderer struct{} 13 | 14 | var listCounter int 15 | 16 | func RoffRenderer(flags int) blackfriday.Renderer { 17 | return &roffRenderer{} 18 | } 19 | 20 | func (r *roffRenderer) GetFlags() int { 21 | return 0 22 | } 23 | 24 | func (r *roffRenderer) TitleBlock(out *bytes.Buffer, text []byte) { 25 | out.WriteString(".TH ") 26 | 27 | splitText := bytes.Split(text, []byte("\n")) 28 | for i, line := range splitText { 29 | line = bytes.TrimPrefix(line, []byte("% ")) 30 | if i == 0 { 31 | line = bytes.Replace(line, []byte("("), []byte("\" \""), 1) 32 | line = bytes.Replace(line, []byte(")"), []byte("\" \""), 1) 33 | } 34 | line = append([]byte("\""), line...) 35 | line = append(line, []byte("\" ")...) 36 | out.Write(line) 37 | } 38 | out.WriteString("\n") 39 | 40 | // disable hyphenation 41 | out.WriteString(".nh\n") 42 | // disable justification (adjust text to left margin only) 43 | out.WriteString(".ad l\n") 44 | } 45 | 46 | func (r *roffRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) { 47 | out.WriteString("\n.PP\n.RS\n\n.nf\n") 48 | escapeSpecialChars(out, text) 49 | out.WriteString("\n.fi\n.RE\n") 50 | } 51 | 52 | func (r *roffRenderer) BlockQuote(out *bytes.Buffer, text []byte) { 53 | out.WriteString("\n.PP\n.RS\n") 54 | out.Write(text) 55 | out.WriteString("\n.RE\n") 56 | } 57 | 58 | func (r *roffRenderer) BlockHtml(out *bytes.Buffer, text []byte) { 59 | out.Write(text) 60 | } 61 | 62 | func (r *roffRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) { 63 | marker := out.Len() 64 | 65 | switch { 66 | case marker == 0: 67 | // This is the doc header 68 | out.WriteString(".TH ") 69 | case level == 1: 70 | out.WriteString("\n\n.SH ") 71 | case level == 2: 72 | out.WriteString("\n.SH ") 73 | default: 74 | out.WriteString("\n.SS ") 75 | } 76 | 77 | if !text() { 78 | out.Truncate(marker) 79 | return 80 | } 81 | } 82 | 83 | func (r *roffRenderer) HRule(out *bytes.Buffer) { 84 | out.WriteString("\n.ti 0\n\\l'\\n(.lu'\n") 85 | } 86 | 87 | func (r *roffRenderer) List(out *bytes.Buffer, text func() bool, flags int) { 88 | marker := out.Len() 89 | if flags&blackfriday.LIST_TYPE_ORDERED != 0 { 90 | listCounter = 1 91 | } 92 | if !text() { 93 | out.Truncate(marker) 94 | return 95 | } 96 | } 97 | 98 | func (r *roffRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) { 99 | if flags&blackfriday.LIST_TYPE_ORDERED != 0 { 100 | out.WriteString(fmt.Sprintf(".IP \"%3d.\" 5\n", listCounter)) 101 | listCounter += 1 102 | } else { 103 | out.WriteString(".IP \\(bu 2\n") 104 | } 105 | out.Write(text) 106 | out.WriteString("\n") 107 | } 108 | 109 | func (r *roffRenderer) Paragraph(out *bytes.Buffer, text func() bool) { 110 | marker := out.Len() 111 | out.WriteString("\n.PP\n") 112 | if !text() { 113 | out.Truncate(marker) 114 | return 115 | } 116 | if marker != 0 { 117 | out.WriteString("\n") 118 | } 119 | } 120 | 121 | func (r *roffRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) { 122 | out.WriteString("\n.TS\nallbox;\n") 123 | 124 | max_delims := 0 125 | lines := strings.Split(strings.TrimRight(string(header), "\n")+"\n"+strings.TrimRight(string(body), "\n"), "\n") 126 | for _, w := range lines { 127 | cur_delims := strings.Count(w, "\t") 128 | if cur_delims > max_delims { 129 | max_delims = cur_delims 130 | } 131 | } 132 | out.Write([]byte(strings.Repeat("l ", max_delims+1) + "\n")) 133 | out.Write([]byte(strings.Repeat("l ", max_delims+1) + ".\n")) 134 | out.Write(header) 135 | if len(header) > 0 { 136 | out.Write([]byte("\n")) 137 | } 138 | 139 | out.Write(body) 140 | out.WriteString("\n.TE\n") 141 | } 142 | 143 | func (r *roffRenderer) TableRow(out *bytes.Buffer, text []byte) { 144 | if out.Len() > 0 { 145 | out.WriteString("\n") 146 | } 147 | out.Write(text) 148 | } 149 | 150 | func (r *roffRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, align int) { 151 | if out.Len() > 0 { 152 | out.WriteString("\t") 153 | } 154 | if len(text) == 0 { 155 | text = []byte{' '} 156 | } 157 | out.Write([]byte("\\fB\\fC" + string(text) + "\\fR")) 158 | } 159 | 160 | func (r *roffRenderer) TableCell(out *bytes.Buffer, text []byte, align int) { 161 | if out.Len() > 0 { 162 | out.WriteString("\t") 163 | } 164 | if len(text) > 30 { 165 | text = append([]byte("T{\n"), text...) 166 | text = append(text, []byte("\nT}")...) 167 | } 168 | if len(text) == 0 { 169 | text = []byte{' '} 170 | } 171 | out.Write(text) 172 | } 173 | 174 | func (r *roffRenderer) Footnotes(out *bytes.Buffer, text func() bool) { 175 | 176 | } 177 | 178 | func (r *roffRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) { 179 | 180 | } 181 | 182 | func (r *roffRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) { 183 | out.WriteString("\n\\[la]") 184 | out.Write(link) 185 | out.WriteString("\\[ra]") 186 | } 187 | 188 | func (r *roffRenderer) CodeSpan(out *bytes.Buffer, text []byte) { 189 | out.WriteString("\\fB\\fC") 190 | escapeSpecialChars(out, text) 191 | out.WriteString("\\fR") 192 | } 193 | 194 | func (r *roffRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) { 195 | out.WriteString("\\fB") 196 | out.Write(text) 197 | out.WriteString("\\fP") 198 | } 199 | 200 | func (r *roffRenderer) Emphasis(out *bytes.Buffer, text []byte) { 201 | out.WriteString("\\fI") 202 | out.Write(text) 203 | out.WriteString("\\fP") 204 | } 205 | 206 | func (r *roffRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { 207 | } 208 | 209 | func (r *roffRenderer) LineBreak(out *bytes.Buffer) { 210 | out.WriteString("\n.br\n") 211 | } 212 | 213 | func (r *roffRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { 214 | out.Write(content) 215 | r.AutoLink(out, link, 0) 216 | } 217 | 218 | func (r *roffRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) { 219 | out.Write(tag) 220 | } 221 | 222 | func (r *roffRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) { 223 | out.WriteString("\\s+2") 224 | out.Write(text) 225 | out.WriteString("\\s-2") 226 | } 227 | 228 | func (r *roffRenderer) StrikeThrough(out *bytes.Buffer, text []byte) { 229 | } 230 | 231 | func (r *roffRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { 232 | 233 | } 234 | 235 | func (r *roffRenderer) Entity(out *bytes.Buffer, entity []byte) { 236 | out.WriteString(html.UnescapeString(string(entity))) 237 | } 238 | 239 | func processFooterText(text []byte) []byte { 240 | text = bytes.TrimPrefix(text, []byte("% ")) 241 | newText := []byte{} 242 | textArr := strings.Split(string(text), ") ") 243 | 244 | for i, w := range textArr { 245 | if i == 0 { 246 | w = strings.Replace(w, "(", "\" \"", 1) 247 | w = fmt.Sprintf("\"%s\"", w) 248 | } else { 249 | w = fmt.Sprintf(" \"%s\"", w) 250 | } 251 | newText = append(newText, []byte(w)...) 252 | } 253 | newText = append(newText, []byte(" \"\"")...) 254 | 255 | return newText 256 | } 257 | 258 | func (r *roffRenderer) NormalText(out *bytes.Buffer, text []byte) { 259 | escapeSpecialChars(out, text) 260 | } 261 | 262 | func (r *roffRenderer) DocumentHeader(out *bytes.Buffer) { 263 | } 264 | 265 | func (r *roffRenderer) DocumentFooter(out *bytes.Buffer) { 266 | } 267 | 268 | func needsBackslash(c byte) bool { 269 | for _, r := range []byte("-_&\\~") { 270 | if c == r { 271 | return true 272 | } 273 | } 274 | return false 275 | } 276 | 277 | func escapeSpecialChars(out *bytes.Buffer, text []byte) { 278 | for i := 0; i < len(text); i++ { 279 | // escape initial apostrophe or period 280 | if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') { 281 | out.WriteString("\\&") 282 | } 283 | 284 | // directly copy normal characters 285 | org := i 286 | 287 | for i < len(text) && !needsBackslash(text[i]) { 288 | i++ 289 | } 290 | if i > org { 291 | out.Write(text[org:i]) 292 | } 293 | 294 | // escape a character 295 | if i >= len(text) { 296 | break 297 | } 298 | out.WriteByte('\\') 299 | out.WriteByte(text[i]) 300 | } 301 | } 302 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/latex.go: -------------------------------------------------------------------------------- 1 | // 2 | // Blackfriday Markdown Processor 3 | // Available at http://github.com/russross/blackfriday 4 | // 5 | // Copyright © 2011 Russ Ross . 6 | // Distributed under the Simplified BSD License. 7 | // See README.md for details. 8 | // 9 | 10 | // 11 | // 12 | // LaTeX rendering backend 13 | // 14 | // 15 | 16 | package blackfriday 17 | 18 | import ( 19 | "bytes" 20 | ) 21 | 22 | // Latex is a type that implements the Renderer interface for LaTeX output. 23 | // 24 | // Do not create this directly, instead use the LatexRenderer function. 25 | type Latex struct { 26 | } 27 | 28 | // LatexRenderer creates and configures a Latex object, which 29 | // satisfies the Renderer interface. 30 | // 31 | // flags is a set of LATEX_* options ORed together (currently no such options 32 | // are defined). 33 | func LatexRenderer(flags int) Renderer { 34 | return &Latex{} 35 | } 36 | 37 | func (options *Latex) GetFlags() int { 38 | return 0 39 | } 40 | 41 | // render code chunks using verbatim, or listings if we have a language 42 | func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) { 43 | if lang == "" { 44 | out.WriteString("\n\\begin{verbatim}\n") 45 | } else { 46 | out.WriteString("\n\\begin{lstlisting}[language=") 47 | out.WriteString(lang) 48 | out.WriteString("]\n") 49 | } 50 | out.Write(text) 51 | if lang == "" { 52 | out.WriteString("\n\\end{verbatim}\n") 53 | } else { 54 | out.WriteString("\n\\end{lstlisting}\n") 55 | } 56 | } 57 | 58 | func (options *Latex) TitleBlock(out *bytes.Buffer, text []byte) { 59 | 60 | } 61 | 62 | func (options *Latex) BlockQuote(out *bytes.Buffer, text []byte) { 63 | out.WriteString("\n\\begin{quotation}\n") 64 | out.Write(text) 65 | out.WriteString("\n\\end{quotation}\n") 66 | } 67 | 68 | func (options *Latex) BlockHtml(out *bytes.Buffer, text []byte) { 69 | // a pretty lame thing to do... 70 | out.WriteString("\n\\begin{verbatim}\n") 71 | out.Write(text) 72 | out.WriteString("\n\\end{verbatim}\n") 73 | } 74 | 75 | func (options *Latex) Header(out *bytes.Buffer, text func() bool, level int, id string) { 76 | marker := out.Len() 77 | 78 | switch level { 79 | case 1: 80 | out.WriteString("\n\\section{") 81 | case 2: 82 | out.WriteString("\n\\subsection{") 83 | case 3: 84 | out.WriteString("\n\\subsubsection{") 85 | case 4: 86 | out.WriteString("\n\\paragraph{") 87 | case 5: 88 | out.WriteString("\n\\subparagraph{") 89 | case 6: 90 | out.WriteString("\n\\textbf{") 91 | } 92 | if !text() { 93 | out.Truncate(marker) 94 | return 95 | } 96 | out.WriteString("}\n") 97 | } 98 | 99 | func (options *Latex) HRule(out *bytes.Buffer) { 100 | out.WriteString("\n\\HRule\n") 101 | } 102 | 103 | func (options *Latex) List(out *bytes.Buffer, text func() bool, flags int) { 104 | marker := out.Len() 105 | if flags&LIST_TYPE_ORDERED != 0 { 106 | out.WriteString("\n\\begin{enumerate}\n") 107 | } else { 108 | out.WriteString("\n\\begin{itemize}\n") 109 | } 110 | if !text() { 111 | out.Truncate(marker) 112 | return 113 | } 114 | if flags&LIST_TYPE_ORDERED != 0 { 115 | out.WriteString("\n\\end{enumerate}\n") 116 | } else { 117 | out.WriteString("\n\\end{itemize}\n") 118 | } 119 | } 120 | 121 | func (options *Latex) ListItem(out *bytes.Buffer, text []byte, flags int) { 122 | out.WriteString("\n\\item ") 123 | out.Write(text) 124 | } 125 | 126 | func (options *Latex) Paragraph(out *bytes.Buffer, text func() bool) { 127 | marker := out.Len() 128 | out.WriteString("\n") 129 | if !text() { 130 | out.Truncate(marker) 131 | return 132 | } 133 | out.WriteString("\n") 134 | } 135 | 136 | func (options *Latex) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) { 137 | out.WriteString("\n\\begin{tabular}{") 138 | for _, elt := range columnData { 139 | switch elt { 140 | case TABLE_ALIGNMENT_LEFT: 141 | out.WriteByte('l') 142 | case TABLE_ALIGNMENT_RIGHT: 143 | out.WriteByte('r') 144 | default: 145 | out.WriteByte('c') 146 | } 147 | } 148 | out.WriteString("}\n") 149 | out.Write(header) 150 | out.WriteString(" \\\\\n\\hline\n") 151 | out.Write(body) 152 | out.WriteString("\n\\end{tabular}\n") 153 | } 154 | 155 | func (options *Latex) TableRow(out *bytes.Buffer, text []byte) { 156 | if out.Len() > 0 { 157 | out.WriteString(" \\\\\n") 158 | } 159 | out.Write(text) 160 | } 161 | 162 | func (options *Latex) TableHeaderCell(out *bytes.Buffer, text []byte, align int) { 163 | if out.Len() > 0 { 164 | out.WriteString(" & ") 165 | } 166 | out.Write(text) 167 | } 168 | 169 | func (options *Latex) TableCell(out *bytes.Buffer, text []byte, align int) { 170 | if out.Len() > 0 { 171 | out.WriteString(" & ") 172 | } 173 | out.Write(text) 174 | } 175 | 176 | // TODO: this 177 | func (options *Latex) Footnotes(out *bytes.Buffer, text func() bool) { 178 | 179 | } 180 | 181 | func (options *Latex) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) { 182 | 183 | } 184 | 185 | func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) { 186 | out.WriteString("\\href{") 187 | if kind == LINK_TYPE_EMAIL { 188 | out.WriteString("mailto:") 189 | } 190 | out.Write(link) 191 | out.WriteString("}{") 192 | out.Write(link) 193 | out.WriteString("}") 194 | } 195 | 196 | func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) { 197 | out.WriteString("\\texttt{") 198 | escapeSpecialChars(out, text) 199 | out.WriteString("}") 200 | } 201 | 202 | func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) { 203 | out.WriteString("\\textbf{") 204 | out.Write(text) 205 | out.WriteString("}") 206 | } 207 | 208 | func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) { 209 | out.WriteString("\\textit{") 210 | out.Write(text) 211 | out.WriteString("}") 212 | } 213 | 214 | func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { 215 | if bytes.HasPrefix(link, []byte("http://")) || bytes.HasPrefix(link, []byte("https://")) { 216 | // treat it like a link 217 | out.WriteString("\\href{") 218 | out.Write(link) 219 | out.WriteString("}{") 220 | out.Write(alt) 221 | out.WriteString("}") 222 | } else { 223 | out.WriteString("\\includegraphics{") 224 | out.Write(link) 225 | out.WriteString("}") 226 | } 227 | } 228 | 229 | func (options *Latex) LineBreak(out *bytes.Buffer) { 230 | out.WriteString(" \\\\\n") 231 | } 232 | 233 | func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { 234 | out.WriteString("\\href{") 235 | out.Write(link) 236 | out.WriteString("}{") 237 | out.Write(content) 238 | out.WriteString("}") 239 | } 240 | 241 | func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) { 242 | } 243 | 244 | func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) { 245 | out.WriteString("\\textbf{\\textit{") 246 | out.Write(text) 247 | out.WriteString("}}") 248 | } 249 | 250 | func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) { 251 | out.WriteString("\\sout{") 252 | out.Write(text) 253 | out.WriteString("}") 254 | } 255 | 256 | // TODO: this 257 | func (options *Latex) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { 258 | 259 | } 260 | 261 | func needsBackslash(c byte) bool { 262 | for _, r := range []byte("_{}%$&\\~#") { 263 | if c == r { 264 | return true 265 | } 266 | } 267 | return false 268 | } 269 | 270 | func escapeSpecialChars(out *bytes.Buffer, text []byte) { 271 | for i := 0; i < len(text); i++ { 272 | // directly copy normal characters 273 | org := i 274 | 275 | for i < len(text) && !needsBackslash(text[i]) { 276 | i++ 277 | } 278 | if i > org { 279 | out.Write(text[org:i]) 280 | } 281 | 282 | // escape a character 283 | if i >= len(text) { 284 | break 285 | } 286 | out.WriteByte('\\') 287 | out.WriteByte(text[i]) 288 | } 289 | } 290 | 291 | func (options *Latex) Entity(out *bytes.Buffer, entity []byte) { 292 | // TODO: convert this into a unicode character or something 293 | out.Write(entity) 294 | } 295 | 296 | func (options *Latex) NormalText(out *bytes.Buffer, text []byte) { 297 | escapeSpecialChars(out, text) 298 | } 299 | 300 | // header and footer 301 | func (options *Latex) DocumentHeader(out *bytes.Buffer) { 302 | out.WriteString("\\documentclass{article}\n") 303 | out.WriteString("\n") 304 | out.WriteString("\\usepackage{graphicx}\n") 305 | out.WriteString("\\usepackage{listings}\n") 306 | out.WriteString("\\usepackage[margin=1in]{geometry}\n") 307 | out.WriteString("\\usepackage[utf8]{inputenc}\n") 308 | out.WriteString("\\usepackage{verbatim}\n") 309 | out.WriteString("\\usepackage[normalem]{ulem}\n") 310 | out.WriteString("\\usepackage{hyperref}\n") 311 | out.WriteString("\n") 312 | out.WriteString("\\hypersetup{colorlinks,%\n") 313 | out.WriteString(" citecolor=black,%\n") 314 | out.WriteString(" filecolor=black,%\n") 315 | out.WriteString(" linkcolor=black,%\n") 316 | out.WriteString(" urlcolor=black,%\n") 317 | out.WriteString(" pdfstartview=FitH,%\n") 318 | out.WriteString(" breaklinks=true,%\n") 319 | out.WriteString(" pdfauthor={Blackfriday Markdown Processor v") 320 | out.WriteString(VERSION) 321 | out.WriteString("}}\n") 322 | out.WriteString("\n") 323 | out.WriteString("\\newcommand{\\HRule}{\\rule{\\linewidth}{0.5mm}}\n") 324 | out.WriteString("\\addtolength{\\parskip}{0.5\\baselineskip}\n") 325 | out.WriteString("\\parindent=0pt\n") 326 | out.WriteString("\n") 327 | out.WriteString("\\begin{document}\n") 328 | } 329 | 330 | func (options *Latex) DocumentFooter(out *bytes.Buffer) { 331 | out.WriteString("\n\\end{document}\n") 332 | } 333 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Basics.text: -------------------------------------------------------------------------------- 1 | Markdown: Basics 2 | ================ 3 | 4 | 11 | 12 | 13 | Getting the Gist of Markdown's Formatting Syntax 14 | ------------------------------------------------ 15 | 16 | This page offers a brief overview of what it's like to use Markdown. 17 | The [syntax page] [s] provides complete, detailed documentation for 18 | every feature, but Markdown should be very easy to pick up simply by 19 | looking at a few examples of it in action. The examples on this page 20 | are written in a before/after style, showing example syntax and the 21 | HTML output produced by Markdown. 22 | 23 | It's also helpful to simply try Markdown out; the [Dingus] [d] is a 24 | web application that allows you type your own Markdown-formatted text 25 | and translate it to XHTML. 26 | 27 | **Note:** This document is itself written using Markdown; you 28 | can [see the source for it by adding '.text' to the URL] [src]. 29 | 30 | [s]: /projects/markdown/syntax "Markdown Syntax" 31 | [d]: /projects/markdown/dingus "Markdown Dingus" 32 | [src]: /projects/markdown/basics.text 33 | 34 | 35 | ## Paragraphs, Headers, Blockquotes ## 36 | 37 | A paragraph is simply one or more consecutive lines of text, separated 38 | by one or more blank lines. (A blank line is any line that looks like a 39 | blank line -- a line containing nothing spaces or tabs is considered 40 | blank.) Normal paragraphs should not be intended with spaces or tabs. 41 | 42 | Markdown offers two styles of headers: *Setext* and *atx*. 43 | Setext-style headers for `

    ` and `

    ` are created by 44 | "underlining" with equal signs (`=`) and hyphens (`-`), respectively. 45 | To create an atx-style header, you put 1-6 hash marks (`#`) at the 46 | beginning of the line -- the number of hashes equals the resulting 47 | HTML header level. 48 | 49 | Blockquotes are indicated using email-style '`>`' angle brackets. 50 | 51 | Markdown: 52 | 53 | A First Level Header 54 | ==================== 55 | 56 | A Second Level Header 57 | --------------------- 58 | 59 | Now is the time for all good men to come to 60 | the aid of their country. This is just a 61 | regular paragraph. 62 | 63 | The quick brown fox jumped over the lazy 64 | dog's back. 65 | 66 | ### Header 3 67 | 68 | > This is a blockquote. 69 | > 70 | > This is the second paragraph in the blockquote. 71 | > 72 | > ## This is an H2 in a blockquote 73 | 74 | 75 | Output: 76 | 77 |

    A First Level Header

    78 | 79 |

    A Second Level Header

    80 | 81 |

    Now is the time for all good men to come to 82 | the aid of their country. This is just a 83 | regular paragraph.

    84 | 85 |

    The quick brown fox jumped over the lazy 86 | dog's back.

    87 | 88 |

    Header 3

    89 | 90 |
    91 |

    This is a blockquote.

    92 | 93 |

    This is the second paragraph in the blockquote.

    94 | 95 |

    This is an H2 in a blockquote

    96 |
    97 | 98 | 99 | 100 | ### Phrase Emphasis ### 101 | 102 | Markdown uses asterisks and underscores to indicate spans of emphasis. 103 | 104 | Markdown: 105 | 106 | Some of these words *are emphasized*. 107 | Some of these words _are emphasized also_. 108 | 109 | Use two asterisks for **strong emphasis**. 110 | Or, if you prefer, __use two underscores instead__. 111 | 112 | Output: 113 | 114 |

    Some of these words are emphasized. 115 | Some of these words are emphasized also.

    116 | 117 |

    Use two asterisks for strong emphasis. 118 | Or, if you prefer, use two underscores instead.

    119 | 120 | 121 | 122 | ## Lists ## 123 | 124 | Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`, 125 | `+`, and `-`) as list markers. These three markers are 126 | interchangable; this: 127 | 128 | * Candy. 129 | * Gum. 130 | * Booze. 131 | 132 | this: 133 | 134 | + Candy. 135 | + Gum. 136 | + Booze. 137 | 138 | and this: 139 | 140 | - Candy. 141 | - Gum. 142 | - Booze. 143 | 144 | all produce the same output: 145 | 146 |
      147 |
    • Candy.
    • 148 |
    • Gum.
    • 149 |
    • Booze.
    • 150 |
    151 | 152 | Ordered (numbered) lists use regular numbers, followed by periods, as 153 | list markers: 154 | 155 | 1. Red 156 | 2. Green 157 | 3. Blue 158 | 159 | Output: 160 | 161 |
      162 |
    1. Red
    2. 163 |
    3. Green
    4. 164 |
    5. Blue
    6. 165 |
    166 | 167 | If you put blank lines between items, you'll get `

    ` tags for the 168 | list item text. You can create multi-paragraph list items by indenting 169 | the paragraphs by 4 spaces or 1 tab: 170 | 171 | * A list item. 172 | 173 | With multiple paragraphs. 174 | 175 | * Another item in the list. 176 | 177 | Output: 178 | 179 |

      180 |
    • A list item.

      181 |

      With multiple paragraphs.

    • 182 |
    • Another item in the list.

    • 183 |
    184 | 185 | 186 | 187 | ### Links ### 188 | 189 | Markdown supports two styles for creating links: *inline* and 190 | *reference*. With both styles, you use square brackets to delimit the 191 | text you want to turn into a link. 192 | 193 | Inline-style links use parentheses immediately after the link text. 194 | For example: 195 | 196 | This is an [example link](http://example.com/). 197 | 198 | Output: 199 | 200 |

    This is an 201 | example link.

    202 | 203 | Optionally, you may include a title attribute in the parentheses: 204 | 205 | This is an [example link](http://example.com/ "With a Title"). 206 | 207 | Output: 208 | 209 |

    This is an 210 | example link.

    211 | 212 | Reference-style links allow you to refer to your links by names, which 213 | you define elsewhere in your document: 214 | 215 | I get 10 times more traffic from [Google][1] than from 216 | [Yahoo][2] or [MSN][3]. 217 | 218 | [1]: http://google.com/ "Google" 219 | [2]: http://search.yahoo.com/ "Yahoo Search" 220 | [3]: http://search.msn.com/ "MSN Search" 221 | 222 | Output: 223 | 224 |

    I get 10 times more traffic from Google than from Yahoo or MSN.

    228 | 229 | The title attribute is optional. Link names may contain letters, 230 | numbers and spaces, but are *not* case sensitive: 231 | 232 | I start my morning with a cup of coffee and 233 | [The New York Times][NY Times]. 234 | 235 | [ny times]: http://www.nytimes.com/ 236 | 237 | Output: 238 | 239 |

    I start my morning with a cup of coffee and 240 | The New York Times.

    241 | 242 | 243 | ### Images ### 244 | 245 | Image syntax is very much like link syntax. 246 | 247 | Inline (titles are optional): 248 | 249 | ![alt text](/path/to/img.jpg "Title") 250 | 251 | Reference-style: 252 | 253 | ![alt text][id] 254 | 255 | [id]: /path/to/img.jpg "Title" 256 | 257 | Both of the above examples produce the same output: 258 | 259 | alt text 260 | 261 | 262 | 263 | ### Code ### 264 | 265 | In a regular paragraph, you can create code span by wrapping text in 266 | backtick quotes. Any ampersands (`&`) and angle brackets (`<` or 267 | `>`) will automatically be translated into HTML entities. This makes 268 | it easy to use Markdown to write about HTML example code: 269 | 270 | I strongly recommend against using any `` tags. 271 | 272 | I wish SmartyPants used named entities like `—` 273 | instead of decimal-encoded entites like `—`. 274 | 275 | Output: 276 | 277 |

    I strongly recommend against using any 278 | <blink> tags.

    279 | 280 |

    I wish SmartyPants used named entities like 281 | &mdash; instead of decimal-encoded 282 | entites like &#8212;.

    283 | 284 | 285 | To specify an entire block of pre-formatted code, indent every line of 286 | the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`, 287 | and `>` characters will be escaped automatically. 288 | 289 | Markdown: 290 | 291 | If you want your page to validate under XHTML 1.0 Strict, 292 | you've got to put paragraph tags in your blockquotes: 293 | 294 |
    295 |

    For example.

    296 |
    297 | 298 | Output: 299 | 300 |

    If you want your page to validate under XHTML 1.0 Strict, 301 | you've got to put paragraph tags in your blockquotes:

    302 | 303 |
    <blockquote>
    304 |         <p>For example.</p>
    305 |     </blockquote>
    306 |     
    307 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/testdata/Markdown Documentation - Basics.html: -------------------------------------------------------------------------------- 1 |

    Markdown: Basics

    2 | 3 | 10 | 11 |

    Getting the Gist of Markdown's Formatting Syntax

    12 | 13 |

    This page offers a brief overview of what it's like to use Markdown. 14 | The syntax page provides complete, detailed documentation for 15 | every feature, but Markdown should be very easy to pick up simply by 16 | looking at a few examples of it in action. The examples on this page 17 | are written in a before/after style, showing example syntax and the 18 | HTML output produced by Markdown.

    19 | 20 |

    It's also helpful to simply try Markdown out; the Dingus is a 21 | web application that allows you type your own Markdown-formatted text 22 | and translate it to XHTML.

    23 | 24 |

    Note: This document is itself written using Markdown; you 25 | can see the source for it by adding '.text' to the URL.

    26 | 27 |

    Paragraphs, Headers, Blockquotes

    28 | 29 |

    A paragraph is simply one or more consecutive lines of text, separated 30 | by one or more blank lines. (A blank line is any line that looks like a 31 | blank line -- a line containing nothing spaces or tabs is considered 32 | blank.) Normal paragraphs should not be intended with spaces or tabs.

    33 | 34 |

    Markdown offers two styles of headers: Setext and atx. 35 | Setext-style headers for <h1> and <h2> are created by 36 | "underlining" with equal signs (=) and hyphens (-), respectively. 37 | To create an atx-style header, you put 1-6 hash marks (#) at the 38 | beginning of the line -- the number of hashes equals the resulting 39 | HTML header level.

    40 | 41 |

    Blockquotes are indicated using email-style '>' angle brackets.

    42 | 43 |

    Markdown:

    44 | 45 |
    A First Level Header
     46 | ====================
     47 | 
     48 | A Second Level Header
     49 | ---------------------
     50 | 
     51 | Now is the time for all good men to come to
     52 | the aid of their country. This is just a
     53 | regular paragraph.
     54 | 
     55 | The quick brown fox jumped over the lazy
     56 | dog's back.
     57 | 
     58 | ### Header 3
     59 | 
     60 | > This is a blockquote.
     61 | > 
     62 | > This is the second paragraph in the blockquote.
     63 | >
     64 | > ## This is an H2 in a blockquote
     65 | 
    66 | 67 |

    Output:

    68 | 69 |
    <h1>A First Level Header</h1>
     70 | 
     71 | <h2>A Second Level Header</h2>
     72 | 
     73 | <p>Now is the time for all good men to come to
     74 | the aid of their country. This is just a
     75 | regular paragraph.</p>
     76 | 
     77 | <p>The quick brown fox jumped over the lazy
     78 | dog's back.</p>
     79 | 
     80 | <h3>Header 3</h3>
     81 | 
     82 | <blockquote>
     83 |     <p>This is a blockquote.</p>
     84 | 
     85 |     <p>This is the second paragraph in the blockquote.</p>
     86 | 
     87 |     <h2>This is an H2 in a blockquote</h2>
     88 | </blockquote>
     89 | 
    90 | 91 |

    Phrase Emphasis

    92 | 93 |

    Markdown uses asterisks and underscores to indicate spans of emphasis.

    94 | 95 |

    Markdown:

    96 | 97 |
    Some of these words *are emphasized*.
     98 | Some of these words _are emphasized also_.
     99 | 
    100 | Use two asterisks for **strong emphasis**.
    101 | Or, if you prefer, __use two underscores instead__.
    102 | 
    103 | 104 |

    Output:

    105 | 106 |
    <p>Some of these words <em>are emphasized</em>.
    107 | Some of these words <em>are emphasized also</em>.</p>
    108 | 
    109 | <p>Use two asterisks for <strong>strong emphasis</strong>.
    110 | Or, if you prefer, <strong>use two underscores instead</strong>.</p>
    111 | 
    112 | 113 |

    Lists

    114 | 115 |

    Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, 116 | +, and -) as list markers. These three markers are 117 | interchangable; this:

    118 | 119 |
    *   Candy.
    120 | *   Gum.
    121 | *   Booze.
    122 | 
    123 | 124 |

    this:

    125 | 126 |
    +   Candy.
    127 | +   Gum.
    128 | +   Booze.
    129 | 
    130 | 131 |

    and this:

    132 | 133 |
    -   Candy.
    134 | -   Gum.
    135 | -   Booze.
    136 | 
    137 | 138 |

    all produce the same output:

    139 | 140 |
    <ul>
    141 | <li>Candy.</li>
    142 | <li>Gum.</li>
    143 | <li>Booze.</li>
    144 | </ul>
    145 | 
    146 | 147 |

    Ordered (numbered) lists use regular numbers, followed by periods, as 148 | list markers:

    149 | 150 |
    1.  Red
    151 | 2.  Green
    152 | 3.  Blue
    153 | 
    154 | 155 |

    Output:

    156 | 157 |
    <ol>
    158 | <li>Red</li>
    159 | <li>Green</li>
    160 | <li>Blue</li>
    161 | </ol>
    162 | 
    163 | 164 |

    If you put blank lines between items, you'll get <p> tags for the 165 | list item text. You can create multi-paragraph list items by indenting 166 | the paragraphs by 4 spaces or 1 tab:

    167 | 168 |
    *   A list item.
    169 | 
    170 |     With multiple paragraphs.
    171 | 
    172 | *   Another item in the list.
    173 | 
    174 | 175 |

    Output:

    176 | 177 |
    <ul>
    178 | <li><p>A list item.</p>
    179 | <p>With multiple paragraphs.</p></li>
    180 | <li><p>Another item in the list.</p></li>
    181 | </ul>
    182 | 
    183 | 184 |

    Links

    185 | 186 |

    Markdown supports two styles for creating links: inline and 187 | reference. With both styles, you use square brackets to delimit the 188 | text you want to turn into a link.

    189 | 190 |

    Inline-style links use parentheses immediately after the link text. 191 | For example:

    192 | 193 |
    This is an [example link](http://example.com/).
    194 | 
    195 | 196 |

    Output:

    197 | 198 |
    <p>This is an <a href="http://example.com/">
    199 | example link</a>.</p>
    200 | 
    201 | 202 |

    Optionally, you may include a title attribute in the parentheses:

    203 | 204 |
    This is an [example link](http://example.com/ "With a Title").
    205 | 
    206 | 207 |

    Output:

    208 | 209 |
    <p>This is an <a href="http://example.com/" title="With a Title">
    210 | example link</a>.</p>
    211 | 
    212 | 213 |

    Reference-style links allow you to refer to your links by names, which 214 | you define elsewhere in your document:

    215 | 216 |
    I get 10 times more traffic from [Google][1] than from
    217 | [Yahoo][2] or [MSN][3].
    218 | 
    219 | [1]: http://google.com/        "Google"
    220 | [2]: http://search.yahoo.com/  "Yahoo Search"
    221 | [3]: http://search.msn.com/    "MSN Search"
    222 | 
    223 | 224 |

    Output:

    225 | 226 |
    <p>I get 10 times more traffic from <a href="http://google.com/"
    227 | title="Google">Google</a> than from <a href="http://search.yahoo.com/"
    228 | title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
    229 | title="MSN Search">MSN</a>.</p>
    230 | 
    231 | 232 |

    The title attribute is optional. Link names may contain letters, 233 | numbers and spaces, but are not case sensitive:

    234 | 235 |
    I start my morning with a cup of coffee and
    236 | [The New York Times][NY Times].
    237 | 
    238 | [ny times]: http://www.nytimes.com/
    239 | 
    240 | 241 |

    Output:

    242 | 243 |
    <p>I start my morning with a cup of coffee and
    244 | <a href="http://www.nytimes.com/">The New York Times</a>.</p>
    245 | 
    246 | 247 |

    Images

    248 | 249 |

    Image syntax is very much like link syntax.

    250 | 251 |

    Inline (titles are optional):

    252 | 253 |
    ![alt text](/path/to/img.jpg "Title")
    254 | 
    255 | 256 |

    Reference-style:

    257 | 258 |
    ![alt text][id]
    259 | 
    260 | [id]: /path/to/img.jpg "Title"
    261 | 
    262 | 263 |

    Both of the above examples produce the same output:

    264 | 265 |
    <img src="/path/to/img.jpg" alt="alt text" title="Title" />
    266 | 
    267 | 268 |

    Code

    269 | 270 |

    In a regular paragraph, you can create code span by wrapping text in 271 | backtick quotes. Any ampersands (&) and angle brackets (< or 272 | >) will automatically be translated into HTML entities. This makes 273 | it easy to use Markdown to write about HTML example code:

    274 | 275 |
    I strongly recommend against using any `<blink>` tags.
    276 | 
    277 | I wish SmartyPants used named entities like `&mdash;`
    278 | instead of decimal-encoded entites like `&#8212;`.
    279 | 
    280 | 281 |

    Output:

    282 | 283 |
    <p>I strongly recommend against using any
    284 | <code>&lt;blink&gt;</code> tags.</p>
    285 | 
    286 | <p>I wish SmartyPants used named entities like
    287 | <code>&amp;mdash;</code> instead of decimal-encoded
    288 | entites like <code>&amp;#8212;</code>.</p>
    289 | 
    290 | 291 |

    To specify an entire block of pre-formatted code, indent every line of 292 | the block by 4 spaces or 1 tab. Just like with code spans, &, <, 293 | and > characters will be escaped automatically.

    294 | 295 |

    Markdown:

    296 | 297 |
    If you want your page to validate under XHTML 1.0 Strict,
    298 | you've got to put paragraph tags in your blockquotes:
    299 | 
    300 |     <blockquote>
    301 |         <p>For example.</p>
    302 |     </blockquote>
    303 | 
    304 | 305 |

    Output:

    306 | 307 |
    <p>If you want your page to validate under XHTML 1.0 Strict,
    308 | you've got to put paragraph tags in your blockquotes:</p>
    309 | 
    310 | <pre><code>&lt;blockquote&gt;
    311 |     &lt;p&gt;For example.&lt;/p&gt;
    312 | &lt;/blockquote&gt;
    313 | </code></pre>
    314 | 
    315 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/README.md: -------------------------------------------------------------------------------- 1 | Blackfriday [![Build Status](https://travis-ci.org/russross/blackfriday.svg?branch=master)](https://travis-ci.org/russross/blackfriday) [![GoDoc](https://godoc.org/github.com/russross/blackfriday?status.svg)](https://godoc.org/github.com/russross/blackfriday) 2 | =========== 3 | 4 | Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It 5 | is paranoid about its input (so you can safely feed it user-supplied 6 | data), it is fast, it supports common extensions (tables, smart 7 | punctuation substitutions, etc.), and it is safe for all utf-8 8 | (unicode) input. 9 | 10 | HTML output is currently supported, along with Smartypants 11 | extensions. An experimental LaTeX output engine is also included. 12 | 13 | It started as a translation from C of [Sundown][3]. 14 | 15 | 16 | Installation 17 | ------------ 18 | 19 | Blackfriday is compatible with Go 1. If you are using an older 20 | release of Go, consider using v1.1 of blackfriday, which was based 21 | on the last stable release of Go prior to Go 1. You can find it as a 22 | tagged commit on github. 23 | 24 | With Go 1 and git installed: 25 | 26 | go get github.com/russross/blackfriday 27 | 28 | will download, compile, and install the package into your `$GOPATH` 29 | directory hierarchy. Alternatively, you can achieve the same if you 30 | import it into a project: 31 | 32 | import "github.com/russross/blackfriday" 33 | 34 | and `go get` without parameters. 35 | 36 | Usage 37 | ----- 38 | 39 | For basic usage, it is as simple as getting your input into a byte 40 | slice and calling: 41 | 42 | output := blackfriday.MarkdownBasic(input) 43 | 44 | This renders it with no extensions enabled. To get a more useful 45 | feature set, use this instead: 46 | 47 | output := blackfriday.MarkdownCommon(input) 48 | 49 | ### Sanitize untrusted content 50 | 51 | Blackfriday itself does nothing to protect against malicious content. If you are 52 | dealing with user-supplied markdown, we recommend running blackfriday's output 53 | through HTML sanitizer such as 54 | [Bluemonday](https://github.com/microcosm-cc/bluemonday). 55 | 56 | Here's an example of simple usage of blackfriday together with bluemonday: 57 | 58 | ``` go 59 | import ( 60 | "github.com/microcosm-cc/bluemonday" 61 | "github.com/russross/blackfriday" 62 | ) 63 | 64 | // ... 65 | unsafe := blackfriday.MarkdownCommon(input) 66 | html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) 67 | ``` 68 | 69 | ### Custom options 70 | 71 | If you want to customize the set of options, first get a renderer 72 | (currently either the HTML or LaTeX output engines), then use it to 73 | call the more general `Markdown` function. For examples, see the 74 | implementations of `MarkdownBasic` and `MarkdownCommon` in 75 | `markdown.go`. 76 | 77 | You can also check out `blackfriday-tool` for a more complete example 78 | of how to use it. Download and install it using: 79 | 80 | go get github.com/russross/blackfriday-tool 81 | 82 | This is a simple command-line tool that allows you to process a 83 | markdown file using a standalone program. You can also browse the 84 | source directly on github if you are just looking for some example 85 | code: 86 | 87 | * 88 | 89 | Note that if you have not already done so, installing 90 | `blackfriday-tool` will be sufficient to download and install 91 | blackfriday in addition to the tool itself. The tool binary will be 92 | installed in `$GOPATH/bin`. This is a statically-linked binary that 93 | can be copied to wherever you need it without worrying about 94 | dependencies and library versions. 95 | 96 | ### Sanitized anchor names 97 | 98 | Blackfriday includes an algorithm for creating sanitized anchor names 99 | corresponding to a given input text. This algorithm is used to create 100 | anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The 101 | algorithm has a specification, so that other packages can create 102 | compatible anchor names and links to those anchors. 103 | 104 | The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names. 105 | 106 | [`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to 107 | create compatible links to the anchor names generated by blackfriday. 108 | This algorithm is also implemented in a small standalone package at 109 | [`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients 110 | that want a small package and don't need full functionality of blackfriday. 111 | 112 | 113 | Features 114 | -------- 115 | 116 | All features of Sundown are supported, including: 117 | 118 | * **Compatibility**. The Markdown v1.0.3 test suite passes with 119 | the `--tidy` option. Without `--tidy`, the differences are 120 | mostly in whitespace and entity escaping, where blackfriday is 121 | more consistent and cleaner. 122 | 123 | * **Common extensions**, including table support, fenced code 124 | blocks, autolinks, strikethroughs, non-strict emphasis, etc. 125 | 126 | * **Safety**. Blackfriday is paranoid when parsing, making it safe 127 | to feed untrusted user input without fear of bad things 128 | happening. The test suite stress tests this and there are no 129 | known inputs that make it crash. If you find one, please let me 130 | know and send me the input that does it. 131 | 132 | NOTE: "safety" in this context means *runtime safety only*. In order to 133 | protect yourself against JavaScript injection in untrusted content, see 134 | [this example](https://github.com/russross/blackfriday#sanitize-untrusted-content). 135 | 136 | * **Fast processing**. It is fast enough to render on-demand in 137 | most web applications without having to cache the output. 138 | 139 | * **Thread safety**. You can run multiple parsers in different 140 | goroutines without ill effect. There is no dependence on global 141 | shared state. 142 | 143 | * **Minimal dependencies**. Blackfriday only depends on standard 144 | library packages in Go. The source code is pretty 145 | self-contained, so it is easy to add to any project, including 146 | Google App Engine projects. 147 | 148 | * **Standards compliant**. Output successfully validates using the 149 | W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional. 150 | 151 | 152 | Extensions 153 | ---------- 154 | 155 | In addition to the standard markdown syntax, this package 156 | implements the following extensions: 157 | 158 | * **Intra-word emphasis supression**. The `_` character is 159 | commonly used inside words when discussing code, so having 160 | markdown interpret it as an emphasis command is usually the 161 | wrong thing. Blackfriday lets you treat all emphasis markers as 162 | normal characters when they occur inside a word. 163 | 164 | * **Tables**. Tables can be created by drawing them in the input 165 | using a simple syntax: 166 | 167 | ``` 168 | Name | Age 169 | --------|------ 170 | Bob | 27 171 | Alice | 23 172 | ``` 173 | 174 | * **Fenced code blocks**. In addition to the normal 4-space 175 | indentation to mark code blocks, you can explicitly mark them 176 | and supply a language (to make syntax highlighting simple). Just 177 | mark it like this: 178 | 179 | ``` go 180 | func getTrue() bool { 181 | return true 182 | } 183 | ``` 184 | 185 | You can use 3 or more backticks to mark the beginning of the 186 | block, and the same number to mark the end of the block. 187 | 188 | To preserve classes of fenced code blocks while using the bluemonday 189 | HTML sanitizer, use the following policy: 190 | 191 | ``` go 192 | p := bluemonday.UGCPolicy() 193 | p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code") 194 | html := p.SanitizeBytes(unsafe) 195 | ``` 196 | 197 | * **Definition lists**. A simple definition list is made of a single-line 198 | term followed by a colon and the definition for that term. 199 | 200 | Cat 201 | : Fluffy animal everyone likes 202 | 203 | Internet 204 | : Vector of transmission for pictures of cats 205 | 206 | Terms must be separated from the previous definition by a blank line. 207 | 208 | * **Footnotes**. A marker in the text that will become a superscript number; 209 | a footnote definition that will be placed in a list of footnotes at the 210 | end of the document. A footnote looks like this: 211 | 212 | This is a footnote.[^1] 213 | 214 | [^1]: the footnote text. 215 | 216 | * **Autolinking**. Blackfriday can find URLs that have not been 217 | explicitly marked as links and turn them into links. 218 | 219 | * **Strikethrough**. Use two tildes (`~~`) to mark text that 220 | should be crossed out. 221 | 222 | * **Hard line breaks**. With this extension enabled (it is off by 223 | default in the `MarkdownBasic` and `MarkdownCommon` convenience 224 | functions), newlines in the input translate into line breaks in 225 | the output. 226 | 227 | * **Smart quotes**. Smartypants-style punctuation substitution is 228 | supported, turning normal double- and single-quote marks into 229 | curly quotes, etc. 230 | 231 | * **LaTeX-style dash parsing** is an additional option, where `--` 232 | is translated into `–`, and `---` is translated into 233 | `—`. This differs from most smartypants processors, which 234 | turn a single hyphen into an ndash and a double hyphen into an 235 | mdash. 236 | 237 | * **Smart fractions**, where anything that looks like a fraction 238 | is translated into suitable HTML (instead of just a few special 239 | cases like most smartypant processors). For example, `4/5` 240 | becomes `45`, which renders as 241 | 45. 242 | 243 | 244 | Other renderers 245 | --------------- 246 | 247 | Blackfriday is structured to allow alternative rendering engines. Here 248 | are a few of note: 249 | 250 | * [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown): 251 | provides a GitHub Flavored Markdown renderer with fenced code block 252 | highlighting, clickable header anchor links. 253 | 254 | It's not customizable, and its goal is to produce HTML output 255 | equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode), 256 | except the rendering is performed locally. 257 | 258 | * [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, 259 | but for markdown. 260 | 261 | * LaTeX output: renders output as LaTeX. This is currently part of the 262 | main Blackfriday repository, but may be split into its own project 263 | in the future. If you are interested in owning and maintaining the 264 | LaTeX output component, please be in touch. 265 | 266 | It renders some basic documents, but is only experimental at this 267 | point. In particular, it does not do any inline escaping, so input 268 | that happens to look like LaTeX code will be passed through without 269 | modification. 270 | 271 | * [Md2Vim](https://github.com/FooSoft/md2vim): transforms markdown files into vimdoc format. 272 | 273 | 274 | Todo 275 | ---- 276 | 277 | * More unit testing 278 | * Improve unicode support. It does not understand all unicode 279 | rules (about what constitutes a letter, a punctuation symbol, 280 | etc.), so it may fail to detect word boundaries correctly in 281 | some instances. It is safe on all utf-8 input. 282 | 283 | 284 | License 285 | ------- 286 | 287 | [Blackfriday is distributed under the Simplified BSD License](LICENSE.txt) 288 | 289 | 290 | [1]: http://daringfireball.net/projects/markdown/ "Markdown" 291 | [2]: http://golang.org/ "Go Language" 292 | [3]: https://github.com/vmg/sundown "Sundown" 293 | -------------------------------------------------------------------------------- /test/import-with-vendor-app/app/vendor/github.com/russross/blackfriday/smartypants.go: -------------------------------------------------------------------------------- 1 | // 2 | // Blackfriday Markdown Processor 3 | // Available at http://github.com/russross/blackfriday 4 | // 5 | // Copyright © 2011 Russ Ross . 6 | // Distributed under the Simplified BSD License. 7 | // See README.md for details. 8 | // 9 | 10 | // 11 | // 12 | // SmartyPants rendering 13 | // 14 | // 15 | 16 | package blackfriday 17 | 18 | import ( 19 | "bytes" 20 | ) 21 | 22 | type smartypantsData struct { 23 | inSingleQuote bool 24 | inDoubleQuote bool 25 | } 26 | 27 | func wordBoundary(c byte) bool { 28 | return c == 0 || isspace(c) || ispunct(c) 29 | } 30 | 31 | func tolower(c byte) byte { 32 | if c >= 'A' && c <= 'Z' { 33 | return c - 'A' + 'a' 34 | } 35 | return c 36 | } 37 | 38 | func isdigit(c byte) bool { 39 | return c >= '0' && c <= '9' 40 | } 41 | 42 | func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool, addNBSP bool) bool { 43 | // edge of the buffer is likely to be a tag that we don't get to see, 44 | // so we treat it like text sometimes 45 | 46 | // enumerate all sixteen possibilities for (previousChar, nextChar) 47 | // each can be one of {0, space, punct, other} 48 | switch { 49 | case previousChar == 0 && nextChar == 0: 50 | // context is not any help here, so toggle 51 | *isOpen = !*isOpen 52 | case isspace(previousChar) && nextChar == 0: 53 | // [ "] might be [ "foo...] 54 | *isOpen = true 55 | case ispunct(previousChar) && nextChar == 0: 56 | // [!"] hmm... could be [Run!"] or [("...] 57 | *isOpen = false 58 | case /* isnormal(previousChar) && */ nextChar == 0: 59 | // [a"] is probably a close 60 | *isOpen = false 61 | case previousChar == 0 && isspace(nextChar): 62 | // [" ] might be [...foo" ] 63 | *isOpen = false 64 | case isspace(previousChar) && isspace(nextChar): 65 | // [ " ] context is not any help here, so toggle 66 | *isOpen = !*isOpen 67 | case ispunct(previousChar) && isspace(nextChar): 68 | // [!" ] is probably a close 69 | *isOpen = false 70 | case /* isnormal(previousChar) && */ isspace(nextChar): 71 | // [a" ] this is one of the easy cases 72 | *isOpen = false 73 | case previousChar == 0 && ispunct(nextChar): 74 | // ["!] hmm... could be ["$1.95] or ["!...] 75 | *isOpen = false 76 | case isspace(previousChar) && ispunct(nextChar): 77 | // [ "!] looks more like [ "$1.95] 78 | *isOpen = true 79 | case ispunct(previousChar) && ispunct(nextChar): 80 | // [!"!] context is not any help here, so toggle 81 | *isOpen = !*isOpen 82 | case /* isnormal(previousChar) && */ ispunct(nextChar): 83 | // [a"!] is probably a close 84 | *isOpen = false 85 | case previousChar == 0 /* && isnormal(nextChar) */ : 86 | // ["a] is probably an open 87 | *isOpen = true 88 | case isspace(previousChar) /* && isnormal(nextChar) */ : 89 | // [ "a] this is one of the easy cases 90 | *isOpen = true 91 | case ispunct(previousChar) /* && isnormal(nextChar) */ : 92 | // [!"a] is probably an open 93 | *isOpen = true 94 | default: 95 | // [a'b] maybe a contraction? 96 | *isOpen = false 97 | } 98 | 99 | // Note that with the limited lookahead, this non-breaking 100 | // space will also be appended to single double quotes. 101 | if addNBSP && !*isOpen { 102 | out.WriteString(" ") 103 | } 104 | 105 | out.WriteByte('&') 106 | if *isOpen { 107 | out.WriteByte('l') 108 | } else { 109 | out.WriteByte('r') 110 | } 111 | out.WriteByte(quote) 112 | out.WriteString("quo;") 113 | 114 | if addNBSP && *isOpen { 115 | out.WriteString(" ") 116 | } 117 | 118 | return true 119 | } 120 | 121 | func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 122 | if len(text) >= 2 { 123 | t1 := tolower(text[1]) 124 | 125 | if t1 == '\'' { 126 | nextChar := byte(0) 127 | if len(text) >= 3 { 128 | nextChar = text[2] 129 | } 130 | if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) { 131 | return 1 132 | } 133 | } 134 | 135 | if (t1 == 's' || t1 == 't' || t1 == 'm' || t1 == 'd') && (len(text) < 3 || wordBoundary(text[2])) { 136 | out.WriteString("’") 137 | return 0 138 | } 139 | 140 | if len(text) >= 3 { 141 | t2 := tolower(text[2]) 142 | 143 | if ((t1 == 'r' && t2 == 'e') || (t1 == 'l' && t2 == 'l') || (t1 == 'v' && t2 == 'e')) && 144 | (len(text) < 4 || wordBoundary(text[3])) { 145 | out.WriteString("’") 146 | return 0 147 | } 148 | } 149 | } 150 | 151 | nextChar := byte(0) 152 | if len(text) > 1 { 153 | nextChar = text[1] 154 | } 155 | if smartQuoteHelper(out, previousChar, nextChar, 's', &smrt.inSingleQuote, false) { 156 | return 0 157 | } 158 | 159 | out.WriteByte(text[0]) 160 | return 0 161 | } 162 | 163 | func smartParens(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 164 | if len(text) >= 3 { 165 | t1 := tolower(text[1]) 166 | t2 := tolower(text[2]) 167 | 168 | if t1 == 'c' && t2 == ')' { 169 | out.WriteString("©") 170 | return 2 171 | } 172 | 173 | if t1 == 'r' && t2 == ')' { 174 | out.WriteString("®") 175 | return 2 176 | } 177 | 178 | if len(text) >= 4 && t1 == 't' && t2 == 'm' && text[3] == ')' { 179 | out.WriteString("™") 180 | return 3 181 | } 182 | } 183 | 184 | out.WriteByte(text[0]) 185 | return 0 186 | } 187 | 188 | func smartDash(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 189 | if len(text) >= 2 { 190 | if text[1] == '-' { 191 | out.WriteString("—") 192 | return 1 193 | } 194 | 195 | if wordBoundary(previousChar) && wordBoundary(text[1]) { 196 | out.WriteString("–") 197 | return 0 198 | } 199 | } 200 | 201 | out.WriteByte(text[0]) 202 | return 0 203 | } 204 | 205 | func smartDashLatex(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 206 | if len(text) >= 3 && text[1] == '-' && text[2] == '-' { 207 | out.WriteString("—") 208 | return 2 209 | } 210 | if len(text) >= 2 && text[1] == '-' { 211 | out.WriteString("–") 212 | return 1 213 | } 214 | 215 | out.WriteByte(text[0]) 216 | return 0 217 | } 218 | 219 | func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte, addNBSP bool) int { 220 | if bytes.HasPrefix(text, []byte(""")) { 221 | nextChar := byte(0) 222 | if len(text) >= 7 { 223 | nextChar = text[6] 224 | } 225 | if smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, addNBSP) { 226 | return 5 227 | } 228 | } 229 | 230 | if bytes.HasPrefix(text, []byte("�")) { 231 | return 3 232 | } 233 | 234 | out.WriteByte('&') 235 | return 0 236 | } 237 | 238 | func smartAmp(angledQuotes, addNBSP bool) func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 239 | var quote byte = 'd' 240 | if angledQuotes { 241 | quote = 'a' 242 | } 243 | 244 | return func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 245 | return smartAmpVariant(out, smrt, previousChar, text, quote, addNBSP) 246 | } 247 | } 248 | 249 | func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 250 | if len(text) >= 3 && text[1] == '.' && text[2] == '.' { 251 | out.WriteString("…") 252 | return 2 253 | } 254 | 255 | if len(text) >= 5 && text[1] == ' ' && text[2] == '.' && text[3] == ' ' && text[4] == '.' { 256 | out.WriteString("…") 257 | return 4 258 | } 259 | 260 | out.WriteByte(text[0]) 261 | return 0 262 | } 263 | 264 | func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 265 | if len(text) >= 2 && text[1] == '`' { 266 | nextChar := byte(0) 267 | if len(text) >= 3 { 268 | nextChar = text[2] 269 | } 270 | if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) { 271 | return 1 272 | } 273 | } 274 | 275 | out.WriteByte(text[0]) 276 | return 0 277 | } 278 | 279 | func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 280 | if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { 281 | // is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b 282 | // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8) 283 | // and avoid changing dates like 1/23/2005 into fractions. 284 | numEnd := 0 285 | for len(text) > numEnd && isdigit(text[numEnd]) { 286 | numEnd++ 287 | } 288 | if numEnd == 0 { 289 | out.WriteByte(text[0]) 290 | return 0 291 | } 292 | denStart := numEnd + 1 293 | if len(text) > numEnd+3 && text[numEnd] == 0xe2 && text[numEnd+1] == 0x81 && text[numEnd+2] == 0x84 { 294 | denStart = numEnd + 3 295 | } else if len(text) < numEnd+2 || text[numEnd] != '/' { 296 | out.WriteByte(text[0]) 297 | return 0 298 | } 299 | denEnd := denStart 300 | for len(text) > denEnd && isdigit(text[denEnd]) { 301 | denEnd++ 302 | } 303 | if denEnd == denStart { 304 | out.WriteByte(text[0]) 305 | return 0 306 | } 307 | if len(text) == denEnd || wordBoundary(text[denEnd]) && text[denEnd] != '/' { 308 | out.WriteString("") 309 | out.Write(text[:numEnd]) 310 | out.WriteString("") 311 | out.Write(text[denStart:denEnd]) 312 | out.WriteString("") 313 | return denEnd - 1 314 | } 315 | } 316 | 317 | out.WriteByte(text[0]) 318 | return 0 319 | } 320 | 321 | func smartNumber(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 322 | if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { 323 | if text[0] == '1' && text[1] == '/' && text[2] == '2' { 324 | if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' { 325 | out.WriteString("½") 326 | return 2 327 | } 328 | } 329 | 330 | if text[0] == '1' && text[1] == '/' && text[2] == '4' { 331 | if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 5 && tolower(text[3]) == 't' && tolower(text[4]) == 'h') { 332 | out.WriteString("¼") 333 | return 2 334 | } 335 | } 336 | 337 | if text[0] == '3' && text[1] == '/' && text[2] == '4' { 338 | if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 6 && tolower(text[3]) == 't' && tolower(text[4]) == 'h' && tolower(text[5]) == 's') { 339 | out.WriteString("¾") 340 | return 2 341 | } 342 | } 343 | } 344 | 345 | out.WriteByte(text[0]) 346 | return 0 347 | } 348 | 349 | func smartDoubleQuoteVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte) int { 350 | nextChar := byte(0) 351 | if len(text) > 1 { 352 | nextChar = text[1] 353 | } 354 | if !smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, false) { 355 | out.WriteString(""") 356 | } 357 | 358 | return 0 359 | } 360 | 361 | func smartDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 362 | return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'd') 363 | } 364 | 365 | func smartAngledDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 366 | return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'a') 367 | } 368 | 369 | func smartLeftAngle(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { 370 | i := 0 371 | 372 | for i < len(text) && text[i] != '>' { 373 | i++ 374 | } 375 | 376 | out.Write(text[:i+1]) 377 | return i 378 | } 379 | 380 | type smartCallback func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int 381 | 382 | type smartypantsRenderer [256]smartCallback 383 | 384 | var ( 385 | smartAmpAngled = smartAmp(true, false) 386 | smartAmpAngledNBSP = smartAmp(true, true) 387 | smartAmpRegular = smartAmp(false, false) 388 | smartAmpRegularNBSP = smartAmp(false, true) 389 | ) 390 | 391 | func smartypants(flags int) *smartypantsRenderer { 392 | r := new(smartypantsRenderer) 393 | addNBSP := flags&HTML_SMARTYPANTS_QUOTES_NBSP != 0 394 | if flags&HTML_SMARTYPANTS_ANGLED_QUOTES == 0 { 395 | r['"'] = smartDoubleQuote 396 | if !addNBSP { 397 | r['&'] = smartAmpRegular 398 | } else { 399 | r['&'] = smartAmpRegularNBSP 400 | } 401 | } else { 402 | r['"'] = smartAngledDoubleQuote 403 | if !addNBSP { 404 | r['&'] = smartAmpAngled 405 | } else { 406 | r['&'] = smartAmpAngledNBSP 407 | } 408 | } 409 | r['\''] = smartSingleQuote 410 | r['('] = smartParens 411 | if flags&HTML_SMARTYPANTS_DASHES != 0 { 412 | if flags&HTML_SMARTYPANTS_LATEX_DASHES == 0 { 413 | r['-'] = smartDash 414 | } else { 415 | r['-'] = smartDashLatex 416 | } 417 | } 418 | r['.'] = smartPeriod 419 | if flags&HTML_SMARTYPANTS_FRACTIONS == 0 { 420 | r['1'] = smartNumber 421 | r['3'] = smartNumber 422 | } else { 423 | for ch := '1'; ch <= '9'; ch++ { 424 | r[ch] = smartNumberGeneric 425 | } 426 | } 427 | r['<'] = smartLeftAngle 428 | r['`'] = smartBacktick 429 | return r 430 | } 431 | --------------------------------------------------------------------------------