Any Solutions for this Error?
github.com/sashabaranov/go-openai
../../go/pkg/mod/github.com/sashabaranov/[email protected]/chat_stream.go:31:22: error: expected ‘;’ or ‘}’ or newline 31 | *streamReader[ChatCompletionStreamResponse] | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/chat_stream.go:63:74: error: expected ‘,’ or ‘}’ 63 | streamReader: &streamReader[ChatCompletionStreamResponse]{ | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream.go:15:22: error: expected ‘;’ or ‘}’ or newline 15 | *streamReader[CompletionResponse] | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream.go:52:64: error: expected ‘,’ or ‘}’ 52 | streamReader: &streamReader[CompletionResponse]{ | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:12:9: error: expected signature or type name 12 | ChatCompletionStreamResponse | CompletionResponse | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:15:21: error: expected ‘]’ 15 | type streamReader[T streamable] struct { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:17:9: error: expected declaration 17 | isFinished bool | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:19:9: error: expected declaration 19 | reader *bufio.Reader | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:20:9: error: expected declaration 20 | response *http.Response | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:21:9: error: expected declaration 21 | errAccumulator errorAccumulator | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:22:9: error: expected declaration 22 | unmarshaler unmarshaler | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:23:1: error: expected declaration 23 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:25:27: error: expected ‘)’ 25 | func (stream *streamReader[T]) Recv() (response T, err error) { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:25:27: error: expected function name ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:25:27: error: expected ‘;’ or newline after top level declaration ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:28:17: error: expected declaration 28 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:29:9: error: expected declaration 29 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:33:1: error: expected declaration 33 | waitForData: | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:35:9: error: expected declaration 35 | if err != nil { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:37:17: error: expected declaration 37 | if respErr != nil { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:39:17: error: expected declaration 39 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:40:17: error: expected declaration 40 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:41:9: error: expected declaration 41 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:44:9: error: expected declaration 44 | line = bytes.TrimSpace(line) | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:45:9: error: expected declaration 45 | if !bytes.HasPrefix(line, headerData) { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:46:67: error: expected declaration 46 | if writeErr := stream.errAccumulator.write(line); writeErr != nil { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:48:25: error: expected declaration 48 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:49:17: error: expected declaration 49 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:50:17: error: expected declaration 50 | emptyMessagesCount++ | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:51:17: error: expected declaration 51 | if emptyMessagesCount > stream.emptyMessagesLimit { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:53:25: error: expected declaration 53 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:54:17: error: expected declaration 54 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:56:17: error: expected declaration 56 | goto waitForData | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:57:9: error: expected declaration 57 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:59:9: error: expected declaration 59 | line = bytes.TrimPrefix(line, headerData) | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:60:9: error: expected declaration 60 | if string(line) == "[DONE]" { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:62:17: error: expected declaration 62 | err = io.EOF | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:63:17: error: expected declaration 63 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:64:9: error: expected declaration 64 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:66:9: error: expected declaration 66 | err = stream.unmarshaler.unmarshal(line, &response) | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:67:9: error: expected declaration 67 | return | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:68:1: error: expected declaration 68 | } | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:70:27: error: expected ‘)’ 70 | func (stream *streamReader[T]) Close() { | ^ ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:70:27: error: expected function name ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:70:27: error: expected ‘;’ or newline after top level declaration ../../go/pkg/mod/github.com/sashabaranov/[email protected]/stream_reader.go:72:1: error: expected declaration 72 | } | ^
Same error and no way to use. Looks like we won't get an answer for this unfortunately...
I had gccgo and it didn't work but with golang-go it works for me.
Thx to @suzixo , as he say:
First of all run this command if you are on Linux:
sudo apt-get install golang-go
After that, you can search you subject,
here an example go run main.go detect -n youSubjectHere