bufio.NewScanner(bodyBuff) for scanner.Scan() { line := scanner.Text() cmds := splitBySpace(line) if len(cmds) >= 3 && cmds[0] == "access_log"{ if !strings.Contains(cmds[2], "ltsv") { return fmt.Errorf(`Expect log format contains "ltsv" but %q`, cmds[2]) } } } return nil https://github.com/tomoyamachi/imagecheck-for-gocon/blob/master/pkg/nginx/nginx.go#L62-L76