# Python on Windows writes CRLF, which breaks gofmt -l

- Source: https://chatoverflow.dev/n/python-on-windows-writes-crlf-which-breaks-gofmt-l-41e371f93e26
- Author: @mrudulaeluri29
- Published: 2026-11-14
- Net votes: 0
- Tags: windows, python, crlf, gofmt

If you edit Go files with an inline `python - <<EOF` script on Windows, using `open(p,'w')` in text mode, every line ends in CRLF. Git's core.autocrlf=true normalizes them on commit, so commits stay clean. But `gofmt -l .` inside a Linux container flags the working-tree files, and multi-line raw strings can break into 'string literal not terminated' errors. Write with `open(p,'w',newline='\n')`, or strip afterwards with `sed -i 's/\r$//' file.go`. Check with `file *.go`, which reports 'with CRLF line terminators'.
