Skip to content

Commit bf12dc4

Browse files
authored
feat(rootfs/Dockerfile): add shfmt shell formatter (#170)
1 parent ca17200 commit bf12dc4

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ creating [issues][] and submitting [pull requests][].
3232
* [Packer][]: build automated machine images
3333
* [ruby][]: ruby scripting language
3434
* [shellcheck][]: static analysis for shell scripts
35+
* [shfmt][]: shell script parser, formatter, and interpreter
3536
* [shyaml][]: YAML access from the command line
3637
* [test-cover.sh][]: test coverage for multiple Go packages
3738
* [unzip][]: list, test, and extract files from ZIP archives
@@ -91,11 +92,12 @@ The latest deis/go-dev Docker image is available at:
9192
[Packer]: https://github.com/hashicorp/packer
9293
[ruby]: https://www.ruby-lang.org/
9394
[shellcheck]: https://github.com/koalaman/shellcheck
95+
[shfmt]: https://github.com/mvdan/sh
9496
[shyaml]: https://github.com/0k/shyaml
9597
[test-cover.sh]: https://github.com/deis/docker-go-dev/tree/master/rootfs/usr/local/bin/test-cover.sh
9698
[Ubuntu 16.04]: https://hub.docker.com/_/ubuntu/
9799
[unzip]: https://linux.die.net/man/1/unzip
98100
[upx]: http://upx.sourceforge.net/
99101
[vim]: http://www.vim.org/
100102
[ruby]: https://www.ruby-lang.org/
101-
[wamerican]: https://packages.ubuntu.com/xenial/wamerican
103+
[wamerican]: https://packages.ubuntu.com/xenial/wamerican

rootfs/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ ENV AZCLI_VERSION=2.0.63 \
1313
GOLANGCI_LINT_VERSION=v1.16.0 \
1414
PROTOBUF_VERSION=3.7.0 \
1515
SHELLCHECK_VERSION=v0.6.0 \
16+
SHFMT_VERSION=2.6.4 \
1617
PATH=$PATH:/usr/local/go/bin:/go/bin:/usr/local/bin/docker \
1718
GOPATH=/go
1819

@@ -96,6 +97,9 @@ RUN \
9697
&& curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b ${GOPATH}/bin ${GOLANGCI_LINT_VERSION} \
9798
&& curl -o /usr/local/bin/shellcheck -sSL https://shellcheck.storage.googleapis.com/shellcheck-${SHELLCHECK_VERSION}.linux-x86_64 \
9899
&& chmod +x /usr/local/bin/shellcheck \
100+
&& go get -u mvdan.cc/sh/cmd/shfmt \
101+
&& git -C "$GOPATH/src/mvdan.cc/sh" checkout -q "v$SHFMT_VERSION" \
102+
&& go install -a -ldflags '-extldflags "-static"' mvdan.cc/sh/cmd/shfmt \
99103
&& pip install --disable-pip-version-check --no-cache-dir azure-cli==${AZCLI_VERSION} shyaml \
100104
&& apt-get purge --auto-remove -y libffi-dev python-dev python-pip \
101105
&& apt-get autoremove -y \

0 commit comments

Comments
 (0)