summaryrefslogtreecommitdiff
path: root/lib/go
Commit message (Collapse)AuthorAgeFilesLines
* Fix NewTZlibTransportFactoryWithFactory commentRobert Pająk2023-05-151-1/+1
|
* THRIFT-5685: Revert "THRIFT-5601: Fix forward typedef in go compiler"Yuxuan 'fishy' Wang2023-03-013-9/+48
| | | | | This reverts commit b39370ec3bc96d201bbc82fbde136f98ae605ed1, and also adds a test case for THRIFT-5685.
* go: Use new atomic types introduced in go1.19Yuxuan 'fishy' Wang2023-02-023-10/+10
| | | | | Those come with nocopy protection, so they can prevent bugs like people passing the types by value instead of by pointer from the compiler.
* Update supported go versionsYuxuan 'fishy' Wang2023-02-022-2/+2
| | | | | Following our policy regarding supported go releases, change the supported go versions to 1.19.* and 1.20.* with the release of go 1.20.
* THRIFT-5601: Fix forward typedef in go compilerYuxuan 'fishy' Wang2023-01-032-2/+38
| | | | | | | | | Client: go While https://github.com/apache/thrift/pull/951 fixed the bug with forward typedef used in container values, it also introduced a bug that broke forward typedef used in other cases in go code. Limit the fix of it to only the container key and value types to fix other cases.
* Use multi-module to cleanup top level go.modYuxuan 'fishy' Wang2022-11-026-13/+48
| | | | | | | | | | | | | | | | | Client: go The go library itself does not have any third-party dependencies. We have one third party dependency from the test code, which kind of polluted from top-level go.mod file to the users of thrift go library. We previous tried to clean that up by creating go.mod file at lib/go/thrift, which caused issues to the release process and thus reverted. Use multi-module to separate tests requiring mock to their own modules so that we can keep the top-level go.mod file clean. Also some minor fixes on the github actions go workflow.
* THRIFT-5650: Implement UUID in Go compilerYuxuan 'fishy' Wang2022-10-263-7/+51
| | | | Client: go
* THRIFT-5650: Implement UUID in Go libraryYuxuan 'fishy' Wang2022-10-2114-213/+964
| | | | | | | | | | | | | | Client: go This is only the library part of THRIFT-5650. I still have some open questions for the compiler part so that will be done later. While I'm here, also made some changes to go CI process: * Update ubuntu-bionic to use go 1.18 for travis * Update ubuntu-jammy to use the latest go 1.19.x for travis * Run both go 1.18 and 1.19 for github actions * Also run test/go tests for github actions
* THRIFT-5423: IDL parameter validation for GoSimon Wang2022-09-114-4/+651
| | | | Closes https://github.com/apache/thrift/pull/2469.
* fixed a ton of missing ASF headers in *.thrift filesJens Geyer2022-09-114-0/+76
|
* Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging ↵Jens Geyer2022-09-051-1/+1
| | | | the partially completed uuid implementation to master
* Add a generic sync.Pool wrapper to go libraryYuxuan 'fishy' Wang2022-08-0910-100/+149
| | | | | | | | | | Since we dropped support of Go 1.18-, use generic to avoid dealing with type assertions with interface{}/any. While I'm here, also remove the usages of ioutil, as that's officially marked as deprecated in Go 1.19. Client: go
* THRIFT-5609: Make TJSONProtocol safe to be used in deserializer poolYuxuan 'fishy' Wang2022-08-064-2/+92
| | | | | | | Client: go Add Reset to TJSONProtocol, and call it in deserializer and serializer to make sure that it's always safe to be used in the pool version.
* Update supported go version to 1.18.* and 1.19.*Yuxuan 'fishy' Wang2022-08-022-1/+7
| | | | | | Client: go Also provide generic version of Pointer helper function.
* THRIFT-5605: Client middleware to extract exceptionsYuxuan 'fishy' Wang2022-08-025-3/+316
| | | | | | | | | Client: go Provide ExtractIDLExceptionClientMiddleware client middleware implementation and ExtractExceptionFromResult to extract exceptions defined in thrift IDL into err return so they are accessible from other client middlewares.
* Minor tweak to ErrAbandonRequest in go libraryYuxuan 'fishy' Wang2022-05-212-11/+37
| | | | | | | | | Client: go Make it unwrap to context.Canceled, since the main use case of it is to be returned in lieu of context.Canceled to avoid extra writing to the client, so that if user has any processor middleware that checks for context.Canceled error those would still work.
* THRIFT-5569: Fix size check in TCompactProtocol.ReadListBeginYuxuan 'fishy' Wang2022-05-121-1/+1
| | | | | | | Client: go This was a copy-paste error in the original implementation in 6583f4e52345c3b05a76f0b188836599628356e8.
* THRIFT-5583: Add skip_remote arg to go compilerYuxuan 'fishy' Wang2022-05-101-2/+6
| | | | Client: go
* Update Go versions used in travis and LANGUAGES.mdYuxuan 'fishy' Wang2022-04-256-7/+22
| | | | | | | Per our support policy, drop support of go 1.16 and add support of go 1.18. Also enable go vet in make check, and fix issues reported by go vet.
* THRIFT-5539: Decouple TDuplicateToProtocol out of TDebugProtocolYuxuan 'fishy' Wang2022-03-152-0/+313
| | | | | | | | | | | | | | | Client: go Currently go's TDebugProtocol does two things: log the read/writes, and duplicate all the reads/writes to another TProtocol. For people who only need the second feature, even if they use NopLogger for the logging part, they still need to pay the price of all the fmt.Sprintf calls used by logging, and on some cases those fmt.Sprintf calls alone can cause significant CPU to be wasted (in one of our services fmt.Sprintf called by TDebugProtocol used ~10% of CPU). Create a dedicated TDuplicateToProtocol to reduce cpu waste, and mark TDebugProtocol.DuplicateTo as deprecated.
* THRIFT-5527: Don't swallow idl exceptions in Process functionYuxuan 'fishy' Wang2022-02-233-2/+146
| | | | | | | | | | | Client: go This allows ProcessorMiddlewares to access such exceptions, unless there's a network error writing the response (which takes priority). While I'm here, also make the indentation of Process function more consistent, and make it consistent on returning false and an error when the reading/writing fails.
* THRIFT-5495: close client when shutdown server in go lib郑桐2022-02-163-6/+209
| | | | Client: go
* THRIFT-5509: Suppress noisy log from go's TSimpleServerYuxuan 'fishy' Wang2022-02-081-2/+6
| | | | | | | | | | Client: go This is a follow up of 6f33b0470. After we proactively closed the client connection, processor.Process could return NOT_OPEN as a result, and those errors being logged will cause the log to be very noisy. This will also be cherry-picked into 0.16.0 branch.
* THRIFT-5509: Close connection in IsOpenYuxuan 'fishy' Wang2022-02-031-1/+12
| | | | | | | | | Client: go When the connectivity check failed in IsOpen, close the connection explicitly to avoid connection leaks. This is Path 2 of THRIFT-5509.
* FIX: missing EXTRA_DIST entriesJens Geyer2022-02-022-0/+7
|
* go: Make socketConn.Close thread-safeYuxuan 'fishy' Wang2022-01-083-19/+14
| | | | | | | | | Client: go We used to rely on setting the connection inside TSocket/TSSLSocket as nil after Close is called to mark the connection as closed, but that is not thread safe and causing TSocket.Close/TSSLSocket.Close cannot be called concurrently. Use an atomic int to mark closure instead.
* Use iotest.OneByteReader instead of self implemented oneYuxuan 'fishy' Wang2022-01-062-19/+8
| | | | | | | | Client: go This is a trivial unit test improvement from the last commit. Of course I only discovered the existence of testing/iotest package after I re-invented the wheel.
* THRIFT-5490: Use pooled buffer for TFramedTransportYuxuan 'fishy' Wang2022-01-053-23/+150
| | | | | | | | | Client: go Follow up on d582a8614, do the same thing on TFramedTransport. Also update the test on the implementation of THeaderTransport to make sure that small reads are not broken.
* THRIFT-5490: Use pooled buffer for THeaderTransportYuxuan 'fishy' Wang2021-12-173-20/+133
| | | | | | | | | Client: go Instead of binding 2 buffers (read/write) to each THeaderTransport, grab one from the pool to be used for the whole read/write, and return it back to the pool after the read/write is done. This would help reduce the memory footprint from idle connections.
* skip map value with depth limit郑桐2021-10-181-1/+5
|
* Modified build tags to allow js/wasm targetBalázs Grill2021-09-202-4/+6
|
* go: Fix things staticcheck complains aboutYuxuan 'fishy' Wang2021-08-2718-230/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Client: go Staticcheck is the recommended replacement of the frozen and deprecated official golint linter [1]. Fix the things it complained about (or add lint:ignore directive) in: - lib/go/thrift - lib/go/test/tests - tutorial/go/src - test/go/src - compiler generated code The majority of the fixes are in the following categories: - Use of deprecated function (mainly the TConfiguration related ones) - Redundant break in switch cases - Unused and unexported variables/fields/functions Also in the same spirit as fb539ae, remove the error return from NewTSSLSocket as it can never be non-nil. This change will be cherry-picked into 0.15.0 branch after merged. [1]: https://groups.google.com/g/golang-nuts/c/rCP70Aq_tBc
* THRIFT-5447: Update supported Go versionsYuxuan 'fishy' Wang2021-08-193-1/+41
| | | | | | | | | Client: go Update go versions used in travis to 1.16.7 and 1.17, update LANGUAGES.md, and update go's README to clarify on support policy. This change will be cherry-picked into 0.15.0 branch after merged.
* THRIFT-5453: Defer DNS from NewTSocketConf to TSocket.OpenYuxuan 'fishy' Wang2021-08-112-11/+18
| | | | | | | | | | Client: go We used to do DNS lookups in NewTSocketConf, without any timeout checks. Stop doing that and do DNS lookups in TSocket.Open instead, which already checks for ConnectTimeout set in TConfiguration. Also remove the error return from NewTSocketConf.
* THRIFT-4797: Go import improvementsYuxuan 'fishy' Wang2021-08-015-1/+90
| | | | | | | | | | | | | | | | This change improves two problems in go code imports: 1. Always rename import the thrift package into "thrift", as we allow the user to use a different library to replace the official one from the compiler command line, this makes sure that in compiler generated go code we can always blindly use "thrift.*". 2. We added auto rename import dedup in d9019fc5a4, but in that change for system packages we always use the full import path as the dedup identifier, so system package "database/sql/driver" would not be detected as a conflict against a thrift go namespace of "foo.bar.driver". Use the part after the last "/" in system packages as the dedup identifier instead.
* THRIFT-5389: Fix const generation for optional fieldsYuxuan 'fishy' Wang2021-07-304-1/+303
| | | | | | | | | Client: go The current compiler will generate uncompilable code when we use optional enum and/or typedef'd types in a thrift constant. This fixes the issue, also adds a test for that.
* Update README for go libraryYuxuan 'fishy' Wang2021-07-261-6/+4
| | | | | | | | | | | | | | | | | Because we briefly had go.mod file under lib/go/thrift in e27e82c46b (it was later removed in d9fcdd3dba), using go get github.com/apache/thrift/lib/go/thrift/... (as suggested by the current README) will get that particular version instead of the latest released version. So update README to use go get github.com/apache/thrift instead. Also instead of saying we support Go 1.7+, say we support the officially supported Go releases, as that's our new support policy.
* THRIFT-5404: Allow other types of TTransportException to be timeoutsYuxuan 'fishy' Wang2021-04-283-4/+16
| | | | | | | | | | | | | | | | | | | Client: go Currently we only treat TTransportException with typeId == TIMED_OUT as timeout (return true in Timeout function). When opening a new socket, if we got a connect timeout from net.Dial, we wrap the error as TTransportException with typeId == NOT_OPEN, thus it's no longer treated as a timeout error. Change the error to be directly wrapping the original error (instead of recreate a new error with the same error message), and change tTransportException.Timeout to also return true if the wrapped error is a timeout error. This way we don't have to break anything (if code rely on TTransportException.TypeId being NOT_OPEN in this case, that's still true). While I'm here, also update CHANGES.md from #2359.
* THRIFT-5369: Use MaxMessageSize to check container sizesYuxuan 'fishy' Wang2021-04-094-32/+83
| | | | Client: go
* Fix lib/go/test/fuzz for oss-fuzz projectYuxuan 'fishy' Wang2021-03-263-3/+15
|
* THRIFT-5358: Add go.mod file to root directoryYuxuan 'fishy' Wang2021-03-2424-70/+77
| | | | | | | | | | | | | Client: go This unblocks the development under go 1.16+, which starts to complain when there's no go.mod file in any of the directories. The current approach is certainly not the best solution ever, for example it does not run the tests under lib/go/test/tests but copy them into lib/go/test/gopath/src/sometest and run them there instead, but those improvements can be done in the future in follow up PRs and this should be a good enough first step to unblock developments.
* Adds fuzz target for oss-fuzz integrationPhilippe Antoine2021-03-244-1/+211
|
* Early error check in golang struct readingPhilippe Antoine2021-03-151-2/+5
| | | | avoids a timeout on malformed input found by fuzzing
* Move ConflictingNamesTest to lib/go/testYuxuan 'fishy' Wang2021-02-225-3/+105
| | | | | | | Client: go Also add missing copyright header for files added in https://github.com/apache/thrift/pull/2307.
* Consolidated gitignore & added missing EXTRA_DISTsJens Geyer2021-02-051-15/+17
|
* THRIFT-5337 Go set fields write improvementwangtieju2021-02-033-2/+357
| | | | | | | | | | | | | Client: go There is a duplicate elements check for set in writeFields* function, and it compares elements using reflect.DeepEqual which is expensive. It's much faster that generates a *Equals* function for set elements and call it in duplicate elements check, especially for nested struct element. Closes #2307.
* THRIFT-4914: Make TClient.Call to return the response metaYuxuan 'fishy' Wang2021-01-225-27/+27
| | | | | | | | | Client: go Make a breaking change so that TClient.Call returns the response meta, currently only contains headers but could be expanded in the future, and make a compiler change to compiler generated clients to take advantage of that and provide access to response metadata to users.
* THRIFT-5322: THeaderTransport protocol id fixYuxuan 'fishy' Wang2021-01-222-12/+29
| | | | | | | | | | | | | | Client: go This fixes a bug introduced in https://github.com/apache/thrift/pull/2296, that we mixed the preferred proto id and the detected proto id, which was a bad idea. This change separates them, so when we propagate TConfiguration, we only change the preferred one, which will only be used for new connections, and leave the detected one from existing connections untouched. Also add a test for it.
* THRIFT-5338: Remove lib/go/thrift/go.modYuxuan 'fishy' Wang2021-01-201-3/+0
| | | | | | | | Client: go Having it under a subdirectory has some unexpected consequences, so remove it for now. Another PR will be open up later to add it back to the root directory.
* THRIFT-5338: Raise minimal supported go version to 1.14.14Yuxuan 'fishy' Wang2021-01-2012-57/+63
| | | | | | | | | Client: go - Update Dockerfiles used by travis - Add go.mod file - Modify error handling code to take advantage of errors package updates in go1.13