Skip to main content
Version: 2.8.x(Latest)

Hello everyone! This version is the last one for the year 2022 and the first one for 2023. The main goals of this version are:

  • Using an interface design to solve the coupling issue of the main framework with the third-party open-source component go-redis, making the main framework lighter and more friendly for tool-based usage scenarios.
  • Providing upgrade commands for the main framework, community components, and development tools via development tools, improving the overall usability of the framework and addressing the common issue of version inconsistency between community components and the main framework.
  • Further designing according to the separation of interfaces and implementations, enhancing the integration of registration discovery and configuration management for common services through community components, preparing for the subsequent release of microservice components.

Complete change list: https://github.com/gogf/gf/compare/v2.2.0...v2.3.1

New Features

  1. The heavily coupled redis component is decoupled from the main framework and provided as a community component. The main framework adds a redis interface definition, while the community component redis provides a concrete implementation. Therefore, please note that the usage of the main framework's gredis component has changed, and in projects relying on redis, it is necessary to introduce the community component redis implementation, otherwise method execution will return an error. The original Do/DoVar methods are retained for compatibility, and more than 100 commonly used redis operation methods are added: NoSQL Redis
  2. New common service interface implementations for configuration management and registration discovery components:
  3. Added tool command gf up for convenient framework upgrades, see: Version Upgrade

Improvements

Community Components

Configuration Management

  1. Added nacos interface implementation: https://github.com/gogf/gf/tree/master/contrib/config/nacos

Registration Discovery

  1. Added zookeeper interface implementation: https://github.com/gogf/gf/tree/master/contrib/registry/zookeeper

Database Driver

  1. Fixed the error issue when configuring the Charset parameter for clickhouse.
  2. Improved the retrieval of data table structure results for clickhouse, with the returned Index order consistently starting from 0.
  3. Improved the oracle table structure retrieval SQL to support the float64 data type.
  4. Fixed the implementation of the CheckLocalTypeForField interface for pgsql, where the name was incorrectly defined as CheckLocalTypeForValue, causing attribute field type errors when generating dao code files.
  5. Improved pgsql to add support for schema. Since schema represents "database name" in most database services, and to maintain backward compatibility, a Namespace configuration parameter is added to represent pgsql's Schema, while the original Schema object represents pgsql's catalog.

NoSQL Components

  1. Added redis community component to implement gredis related interfaces: https://github.com/gogf/gf/tree/master/contrib/nosql/redis

Database Components

  1. gdb
  2. To enhance extensibility, the TX transaction object is changed to an interface definition, and the original TX object is renamed to TXCore for convenient custom interface implementation object nesting: ORM - Transaction
  3. Added Namespace configuration item to support issues of distinguishing Catalog&Schema in some database services. The original Schema continues to represent the database name, while the new Namespace represents the Schema configuration in some database services: ORM - Configuration
  4. Improved database name configuration to support Chinese database names.
  5. Added the current database name printout in the SQL execution log.
  6. Fixed the cache issue of the Count method.
  7. gredis
  8. Added redis community component to decouple the heavily coupled redis component from the main framework, and provide it as a community component. The main framework adds a redis interface definition, and the community component redis provides a concrete implementation. Therefore, please note that the usage of the main framework's gredis component has changed, and in projects relying on redis, it is necessary to introduce the community component redis implementation, otherwise method execution will return an error. The original Do/DoVar methods are retained for compatibility, and more than 100 commonly used redis operation methods are added: NoSQL Redis

Container Components

  1. gpool
  2. Added the MustPut method to directly panic instead of returning an error object when Put execution errors occur.
  3. gqueue
  4. Improved the Len/Size methods to resolve potential queue count inaccuracies.
  5. Improved the Len/Size methods, with the return parameter type changed from int to int64.

Error Handling

  1. gcode
  2. Added CodeNecessaryPackageNotImport error code.
  3. gerror
  4. Improved stack prints, using spaces to replace \t to ensure the print format is compatible with different display terminals.

Object Management

  1. gins
  2. Added group lock mechanism for singleton objects to enhance lock mechanism performance under high concurrency.

Network Components

  1. ghttp
  2. Support for obtaining the current execution route method in middleware.
  3. When the execution result of the route method is not 200, support obtaining internal errors through the Request.GetError method in middleware.
  4. Added Response.ServeContent method for custom content output interface implementation.
  5. Improved reverse proxy support and added reverse proxy example: https://github.com/gogf/gf/blob/master/example/httpserver/proxy/main.go
  6. Improved error log output, using the error log level, making it easier for developers to identify log types in custom log Handlers.
  7. goai
  8. Added support for the security tag to configure OpenAPIv3 security keys.
  9. Improved structure attribute name retrieval when the json tag contains ,.
  10. gtcp
  11. Renamed SetSendDeadline method to SetDeadlineSend.
  12. Renamed SetReceiveDeadline method to SetDeadlineRecv.
  13. Renamed SetReceiveBufferWait method to SetBufferWaitRecv.
  14. gudp
  15. Renamed SetSendDeadline method to SetDeadlineSend.
  16. Renamed SetReceiveDeadline method to SetDeadlineRecv.
  17. Renamed SetReceiveBufferWait method to SetBufferWaitRecv.

System Components

  1. gcache
  2. Fixed the MustGetOrSetFunc method logic issue.
  3. Improved the LRU cache expiration recycling mechanism implementation.
  4. gcmd
  5. Improved structured command line object generation, automatically reading dc tag content as brief when the brief tag is empty, ensuring that command line and interface definition tag habits are the same.
  6. gcron
  7. Improved log handling, using glog.DefaultLogger to output error logs when a scheduled task method panic occurs and the developer hasn't set the Logger interface.
  8. Improved scheduled trigger judgment logic, resolving scheduled task triggering issues caused by inaccurate execution intervals of the underlying timer.
  9. glog
  10. Improved initialization logic when rolling split feature is enabled, resolving failure of rolling split execution due to initialization failure in some scenarios.
  11. Improved the Clone method for further shallow copying to enhance chain operation performance.
  12. Added LevelPrint configuration to control whether the default log Handler prints the log level string.
  13. gres
  14. Added Pack*WithOption methods to provide finer-grained resource packaging option control.
  15. Deprecated methods: Pack/PackToFile/PackToGoFile.
  16. Added KeepPath packaging option to control whether to retain the given relative path in the packaged file instead of using a path with a local packaging directory prefix (equivalent to removing the directory prefix).
  17. grpool
  18. Added supervisor feature to solve the issue of low probability of quitting at the same time in scenarios with a small number of workers.
  19. gstructs
  20. Added Tag* methods to obtain common tag values.
  21. gtime
  22. Improved Equal/After/Sub methods to resolve detailed issues in some scenarios.
  23. Improved EndOf* methods, allowing developers to control the granularity of EndOf calculation in the returned time object. The default granularity is changed from nanoseconds to seconds for calculation.
  24. Improved the SetTimeZone method to achieve cross-system compatibility, allowing only a global setting of the time zone once, with errors returned for multiple calls with different time zones: Time - Time Zone

Text Processing

  1. gstr
  2. Fixed IsSubDomain issue of determining that the main domain is a subdomain of a subdomain.
  3. Improved SubStr/SubStrRune methods to support the use of a negative start parameter to specify right-side substring extraction.

Utility Components

  1. gconv
  2. Added Ptr* methods for arbitrary type to specific type pointer variable conversion.
  3. Improved Map* conversion methods for handling recursive conversions, by default, only recursively converting nested structure attributes.
  4. Improved Scan method to resolve conversion issues from attributes of the same type and the same type pointer to target object/pointer.
  5. gtag
  6. Unified all tag names in the framework to be maintained under this module through constants.
  7. Added SetOver/SetsOver methods for overriding custom tag key-value pairs.
  8. gutil
  9. Improved Dump* methods to support printing of circular nested object pointers.
  10. Fixed Dump* method reflection error issues in some scenarios.
  11. Added OriginValueAndKind/OriginTypeAndKind methods to obtain the reflect value/type object of a given variable, as well as the original reflect value/type object under pointer variables.

Bug Fixes

  1. Fixed the issue of utility installation failure in some environments.
  2. Fixed array boundary issue in New*ArrayRange method for array object creation in some scenarios.
  3. Fixed the error issue when configuring the Charset parameter for contrib/drivers/clickhouse.
  4. Fixed attribute field type error issue in pgsql database generated dao code files.
  5. Fixed cache issue with the Count method in the database ORM component.
  6. Fixed gstr.IsSubDomain issue of determining that the main domain is a subdomain of a subdomain.
  7. Fixed gutil.Dump* method reflection error issues in some scenarios.

Development Tools

  1. Added gf fix command for automatically updating local code incompatible changes when upgrading from lower to higher versions: Compatibility Fix
  2. Added gf up command to upgrade local framework versions to the latest framework version: Version Upgrade
  3. Improved gf build command to add environment variable information printing before building.
  4. Improved gf pack command to add KeepPath parameter to control whether to keep the relative path after resource packaging: Resource Packing
  5. Improved gf gen dao command with tx parameter in generated Transaction methods changed from object pointer to interface.

Compatibility Warning

  1. The usage of Redis has changed. The old methods remain compatible, but additional community components need to be imported (interface and implementation separation). Please see the documentation for details.
  2. The TX object of the database ORM is changed from a concrete implementation to an interface. This can be automatically upgraded and fixed using the new up or fix command in the development tools.

Next Version Goals

  • Improve and release the grpcx community component to provide extended support for the grpc interface protocol and enhance the usability of microservice development.
  • Add a [Microservice Development] series chapter on the official website, mainly introducing microservice development using goframe with a focus on grpc development.
  • Remove coupling with the third-party open-source component gorilla/websocket in the main framework, interface the support of WebSocket, and provide concrete implementations through community components according to the general decoupling design of the framework, providing extensibility and flexibility.