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

Hello everyone! Thank you for waiting!

Since the last version release, more and more friends have joined the GoFrame family and provided many valuable suggestions and feedback. This version addresses most of these feedbacks, including most of the improvement suggestions and some new features, which is why this release took more than two months. GoFrame is very focused on code quality and sustainable maintainability. This version further refines the examples, comments, and unit test cases for most modules in the framework. Currently, there are about 1991 unit test cases with a code coverage of 71%, covering most of the main functions of all modules.

The GoFrame framework provides common, high-quality basic development modules, lightweight, modular, and high-performance. We recommend reading the framework source code to learn more details. This release has a few incompatible upgrades, often requiring batch replacements. The following change log is quite comprehensive, and it is recommended to read it carefully before upgrading.

This release marks the start of the next version development plan, and more friends are welcome to participate in open source contributions: https://github.com/gogf/gf/projects/8

Thank you for your support! Enjoy your GoFrame!

GoFrame

GoFrame(Go Frame) is a modular, high-performance, production-grade Golang basic development framework. It implements relatively complete infrastructure construction and development toolchain, providing commonly used basic development modules, such as: cache, log, queue, array, set, container, timer, command line, memory lock, object pool, configuration management, resource management, data validation, data encoding, scheduled tasks, database ORM, TCP/UDP components, process management/communication, etc. It also provides a series of core components for web service development, such as: Router, Cookie, Session, Middleware, service registration, template engine, etc., supporting features like hot restart, hot updates, domain binding, TLS/HTTPS, Rewrite, etc.

Features

  • Modular, loosely coupled design;
  • Rich modules, ready to use;
  • Simple and easy to use, easy to maintain;
  • Active community, modest and approachable experts;
  • High code quality, high unit test coverage;
  • Detailed development documentation and examples;
  • Complete native Chinese support;
  • More suitable for enterprise and team use;

Address

Change Log

From GoFrame v1.12 version, the minimum Golang runtime version required by the framework is v1.13. Since new versions of Golang are backward compatible, it is recommended to update to use the new version of Golang: https://golang.google.cn/dl/

This version also introduces support for the Swagger tools and plugins, released separately.

tool chain

  1. The gen model command adds model generation support for pgsql/mssql/sqlite/oracle.
  2. The gen model command generates a public package variable Columns for retrieving table field names.

net

  1. ghttp
    • Note: Starting from this version, the Server has the graceful restart feature disabled by default. Developers can enable it through the appropriate configuration options.
    • Improved Client.Get method with optional request parameters.
    • Added chainable methods for Client: Header, HeaderRaw, Cookie, ContentType, ContentJson, ContentXml, Timeout, BasicAuth, Ctx: https://goframe.org/net/ghttp/client/chain
    • Added context variable management methods Request.GetCtx/GetCtxVar/SetCtxVar/Context for internal request context variables:
    • Added Request.GetUploadFile/GetUploadFiles methods and UploadFile type, greatly simplifying file upload processing logic: https://goframe.org/net/ghttp/client/demo/upload
    • Added Request.GetPage method for convenient pagination object retrieval:
    • Improved Response.Redirect* method with a customizable HTTP status code parameter for redirection.
    • Enhanced CORS feature, improved cross-origin handling, fully conforming to W3C specifications regarding the OPTIONS request method: https://goframe.org/net/ghttp/cors
    • Added Request built-in variable to template view objects, allowing templates to obtain request parameters. As the GoFrame framework's template engine uses a two-level cache design, it reduces IO overhead while improving execution efficiency. Even with a large number of built-in variables and methods added, extensive performance tests have shown that efficiency is 50% to 200% higher than other WebServer libraries under the same logic.
    • Introduced an experimental Plugin feature for Server.
    • Improved the underlying route storage and retrieval logic of Server, optimized code, and enhanced efficiency.
    • Enhanced source location tracking for group route registration, allowing for precise location and prompt of duplicate route source locations when there are registration conflicts.
    • Improved Server log handling.
    • Enhanced unit testing.

database

  1. gdb

  2. gredis

    • Increased/modified default database connection pool parameters: MaxIdle=10, IdleTimeout=10s, MaxConnLifetime=30s, Wait=true.
    • Enhanced unit testing.

container

  1. Added UnmarshalValue(interface{}) error interface method implementation to all container objects, used by gconv for creating/setting object content based on arbitrary type variables. All container objects in the GoFrame framework have implemented this interface.

  2. garray

    • Added RemoveValue method for searching and removing elements based on values.
    • Added FilterNil method for traversing and removing nil elements from an array.
    • Added FilterEmpty method for traversing and removing empty value elements from an array. Empty values include: 0, nil, false, "", len(slice/map/chan) == 0.
    • Improved Set/Fill/InsertBefore/InsertAfter methods with stricter validation, changing the original chain operation return value object to error return value.
    • Enhanced Get/Remove/PopRand/PopLeft/PopRight/Rand methods with stricter validation, adding a found boolean return value to indicate if the method has data to return. If the array is empty or the operation is out of range, found returns false.
    • Changed Rands method logic to ensure it returns a random array of the specified size.
    • Enhanced unit testing.
  3. gpool

    • Adjusted the expiration time parameter type of the cache pool. The old version used int type representing milliseconds, while the new version uses time.Duration type making time control more flexible.
    • Internal code optimization and performance improvement.
    • Enhanced unit testing.
    • Improved annotations.

os

  1. glog

  2. gres

    1. Improved resource content encoding design with a new compression algorithm, reducing resource file size, such as the original 15MB website static resource files (css/js/html, etc.) reduced to approximately 4MB after packaging: https://goframe.org/os/gres/index
    2. Note: This improvement is not compatible with the old version and requires re-packing of existing resource files.
    3. Enhanced unit testing.
  3. gcfg

    • Removed atomic concurrency safety control for configuration object attributes, changed to ordinary variable types. Since configuration management is one of the most used modules, high efficiency in design and method implementation is ensured.
    • Significant adjustment to singleton objects: To facilitate the use of configuration files in multi-file scenarios and improve development efficiency, when the toml configuration file corresponding to the given singleton name exists in the configuration directory, the default configuration file of the singleton object is automatically set to this file. For example, the singleton object obtained by g.Cfg("redis") will default to retrieving and setting the default configuration file as redis.toml. If the file does not exist, the default configuration file (config.toml) is used: https://goframe.org/net/ghttp/config
    • Enhanced unit testing.
  4. gview

  5. gfile

    • Improved SelfPath method for obtaining the current executable file path, increasing execution efficiency.
    • Enhanced Join method for connecting file paths, preventing redundant path connection symbols.
    • Improved execution efficiency of GetContents method, reducing memory usage.
    • Added StrToSize method for converting size strings to byte numbers. Size strings include 10m, 5KB, 1.25Gib, etc.
    • Added ReadLines/ReadByteLines methods for reading specified file content line by line with a given read callback function.
    • Enhanced unit testing.
  6. gtime

    • Improved the implementation of gtime.Time object, unified string printed time format to Y-m-d H:i:s, such as 2020-01-01 12:00:00.
  7. gcmd

    • Added strict parameter to command-line parsing methods for determining whether the current parsing is strict. In strict parsing, if illegal options are given, parsing stops and returns an error. By default, it is non-strict parsing.
  8. genv

    • Improved Remove method for deleting environment variable key-value pairs, adding the ability to delete multiple key-value pair environment variables.
  9. gfpool

    • Improved code implementation, increasing efficiency.
    • Enhanced unit testing.
  10. gfsnotify

    • Improved package initialization method. If the default Watcher object fails to create due to system reasons, it panics directly.
  11. gproc

    • Improved SearchBinaryPath method.
    • Improved Process.Kill method for handling different behaviors on windows and *niux platforms.

encoding

  1. gjson

frame

  1. g
    • Added IsNil method to determine if the given variable is nil, potentially using reflection for judgment.
    • Added IsEmpty method to determine if the given variable is empty. This method primarily uses assertion but may use reflection for judgment. Empty values include: 0, nil, false, "", len(slice/map/chan) == 0.
    • Deprecated SetServerGraceful method, managed uniformly through Server configuration.
  2. gins
    • Improved code structure for easier maintenance.
    • Enhanced and improved unit testing.
  3. gmvc
    • Added M type as an alias for *gdb.Model for convenience in toolchain auto-generated models containing the M attribute.

text

  1. gstr
    • Added HasPrefix/HasSuffix methods.
    • Introduced OctStr method for converting octal strings to corresponding unicode strings, such as Chinese. Commonly used in gRPC underlying communication encoding.
    • Enhanced unit testing.

debug

  1. gdebug
    • Improved code structure for easier maintenance.
    • Added TestDataPath method for obtaining the absolute path of the testdata directory in the current package for package unit tests.

util

  1. gconv

    • Improved String conversion method with built-in support for time.Time/*time.Time/gtime.Time types.
    • Enhanced Map/Struct conversion methods with additional detail handling for special scenarios. Continuous improvement based on extensive usage and feedback.
    • Updated Struct conversion method to support UnmarshalValue(interface{}) error interface.
    • Enhanced unit testing.
  2. grand

    • Note: Incompatible adjustment, the original Str method renamed to S for obtaining a random string of specified length along with the symbol parameter, to specify whether special visible characters can be returned randomly.
    • Added Str method for randomly retrieving a string of specified length from specified string characters, supporting unicode strings, such as Chinese: https://goframe.org/util/grand/index
    • Added Symbols method for randomly returning special visible characters for specified purposes: https://goframe.org/util/grand/index
    • Enhanced unit testing.
  3. gvalid

    • Length validation rules now support unicode strings, such as Chinese.

Bug Fix

  1. Fixed the view object configuration issue in Server.
  2. Fixed the issue where middleware in Server ignored Middleware.Next method control in the event of panic in middleware, causing authentication middleware to fail.
  3. Resolved the gudp.Server packet loss problem when request packet size exceeds 64bytes, and the default buffer size has been adjusted to 1024bytes. Developers can customize buffer size.
  4. Corrected gfile.MTimeMillisecond method to return the correct file modification millisecond timestamp.
  5. Fixed gconv.Int64 conversion support for negative numbers.
  6. Various other fixes.
  7. For details, see: https://github.com/gogf/gf/issues?q=label%3Abug