LoginSignup
25
8

More than 5 years have passed since last update.

dockerでbuildしたら"Empty continuation lines will become errors in a future release"って言われた

Posted at

はじめに

docker for macにアップデートがきたので17.09.0-ceにupdateして作業を再開(build)したら急にWarningが出て焦りました。

[WARNING]: Empty continuation line found in:
...
[WARNING]: Empty continuation lines will become errors in a future release.

いったい何があったのか

ChangeLogを追ってみたところ、17.07.0-ceこんな修正(Issue)があったようです。

-           // TODO: warn this is being deprecated/removed
            if isEmptyContinuationLine(bytesRead) {
+               hasEmptyContinuationLine = true
                continue
            }

要は今までスルーされていた空行はスルーするんじゃなくて警告するようにした模様。
本来この修正で警告を出したかったのは、

RUN apt-get update -y && \
    (空行)
    apt-get upgrade -y && \
    ...

などのように、空行に対する警告なのですが、
ここで判定に使われているisEmptyCOntinuationLine(...)関数(以前から存在)は

func isEmptyContinuationLine(line []byte) bool {
    return len(trimComments(trimWhitespace(line))) == 0
}

という実装で、# install xxxxなどのコメントは長さ0として扱います。
そのため、今までは

RUN apt-get update -y && apt-get upgrade -y && \
    apt-get install -y vim git curl wget \
                       make g++ python libkrb5-dev && \
    # install nodejs(dependency: 6.x)
    curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
    apt-get install -y nodejs && \
    ...

などのようにコメントを途中にはさみながら書いていた部分に対して警告が行われるようになったということでした。

おわりに

警告は消しておきたい派の筆者はとりあえずコメントを消して事なきを得ましたが、
その代わりに分かりにくい部分の補足をしてくれていたコメントとさよならすることになりました。
こんなときどんな風にするのが良いのでしょう。。

25
8
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
8