Why using unix-compress and go compress/lzw produce different files, not readable by the other decoder?
问题 I compressed a file in a terminal with compress file.txt and got (as expected) file.txt.Z When I pass that file to ioutil.ReadFile in Go, buf0, err := ioutil.ReadFile("file.txt.Z") I get the error (the line above is 116): finder_test.go:116: lzw: invalid code I found that Go would accept the file if I compress it using the compress/lzw package, I just used code from a website that does that. I only modified the line outputFile, err := os.Create("file.txt.lzw") I changed the .lzw to .Z . then