GoFrame

GF(Go Frame) is a modular, high-performance, production-grade Go foundational development framework. It provides comprehensive infrastructure and development toolchain, offering commonly used development modules such as caching, logging, queue, array, collection, container, timer, command line, memory lock, object pool, configuration management, resource management, data validation, data encoding, cron jobs, database ORM, TCP/UDP components, process management/communication, etc. Moreover, it includes core components for web service development, such as Router, Cookie, Session, Middleware, service registration, template engine, and it supports hot restart, hot update, domain binding, TLS/HTTPS, Rewrite, etc.

Features

  • Modular, loosely-coupled design;
  • Rich modules, ready to use;
  • Easy to use, easy to maintain;
  • High code quality, high unit test coverage;
  • Active community with humble and amiable experts;
  • Comprehensive documentation and examples;
  • Complete localization support in Chinese;
  • Designed for team and enterprise use;

Development

GoFrame originated in Beijing in 2011, from a smart IoT platform project before many current IoT standards existed, and when Go’s standard library and ecosystem were not as rich. It wasn’t until 2017 that GoFrame released its test version, and in 2018, during the 1024 programmer’s festival, it released the official v1.0 version, contributing to the Go ecosystem’s development. Since its open-source launch, it has iterated quickly, growing widely favored by developers and enterprises, with many developers contributing. Originally designed for development teams, its development efficiency and maintainability are excellent, with high code quality and abundant unit tests and examples. GoFrame is currently the best Go development framework with localized Chinese documentation.

Change Log

  1. At the request of many developers, the minimum Golang runtime version required by the framework has been downgraded to v1.11.
  2. Added new GoFrame video tutorial addresses:
  3. The rarely-used guuid module has been moved to github.com/gogf/guuid as a community-maintained module, keeping the main gf repository lightweight.
  4. Added guid module for efficient, lightweight unique string generation: https://goframe.org/util/guid/index

tool chain

  1. Toolchain update: https://goframe.org/toolchain/cli
  2. Added gf env command for elegantly viewing current Golang environment variable information.
  3. Added gf mod path command to copy the current go modules package to GOPATH, facilitating project development using the original GOPATH method.
  4. Made improvements to existing cli commands, enhancing user experience; precompiled binary versions are upx compressed on some platforms, reducing file size for downloading.

container

  1. garray
    • https://goframe.org/container/garray/index
    • Simplified array usage, supporting variable definitions like var garray.Array;
    • Added Walk method for custom array element processing;
    • Added ContainsI method for case-insensitive array element existence checking;
    • Enhanced unit tests, code coverage at 94%;
    • Code refinement, performance improvement;
    • Fixed some issues;
  2. gchan
    • Due to its limited practical significance, the package has been removed from the main framework;
  3. glist
  4. gmap
  5. gset
    • https://goframe.org/container/gset/index
    • Simplified set usage, supporting variable definitions like var gset.Set;
    • Added Walk method for custom set element processing;
    • Enhanced unit tests, code coverage at 90%;
    • Code refinement, performance improvement;
  6. gtree
  7. gvar

database

  1. gdb
  2. gredis
    • Added default configuration for MaxActive connection pool parameter to 100 to limit the default number of connections;
    • Improved Conn object’s Do method to support automatic json.Marshal for map/slice/struct types, use DoVar method to retrieve data: https://goframe.org/database/gredis/usage
    • Enhanced unit tests, code coverage at 72%;

net

  1. ghttp

    • Added Prefix and Retry client chain operation methods;
    • Added client raw request printing feature: https://goframe.org/net/ghttp/client/demo/dump
    • Added ClientMaxBodySize server configuration to limit the client’s submitted Body size, default is 8MB; increase this configuration size in servers involving upload, specify the size in the configuration file, e.g., ClientMaxBodySize="100MB": https://goframe.org/net/ghttp/config
    • Improved randomness of SessionId generation, enhancing Session security: https://goframe.org/os/gsession/index
    • ghttp.Server now implements the standard library’s http.Handler interface, facilitating code integration with third-party services like Prometheus;
    • Numerous code detail improvements for performance and long-term maintainability;
    • Enhanced unit tests, code coverage at 61%;
  2. gipv4

    • Added GetIpArray method for retrieving all current host IPv4 addresses;
    • Added GetMacArray and GetMac methods for obtaining current host’s MAC address information;
    • Changed IntranetIP method name to GetIntranetIp, changed IntranetIPArray method name to GetIntranetIpArray;

encoding

  1. gjson
    • Added GetMaps method to retrieve JSON internal node variable;
    • Improved NewWithTag method to handle map/struct;
    • Enhanced unit tests, code coverage at 77%;
  2. gyaml
    • Upgraded the dependent third-party yaml parsing package, addressing the map[interface{}]interface{} conversion issue;

error

  1. gerror
    • Added NewfSkip method for creating error objects with specified stack skip;
    • Enabled stack trace printing throughout the framework to show real link call details when errors occur;

os

  1. gcache

    • Added GetVar method for obtaining “generic” variables easily convertible to other data types;
    • Deprecated Removes method, improved Remove method to variadic parameters, unified usage for removing one/multiple key-value pairs;
    • Enhanced unit tests, code coverage at 96%;
  2. genv

    • Added GetVar method for obtaining “generic” variables easily convertible to other data types;
  3. gfile

    • Improved CopyDir/CopyFile methods;
    • Added ScanDirFunc method for directory retrieval with custom processing callback support;
    • Enhanced unit tests, code coverage at 64%;
  4. glog

  5. gres

    • Improved packaging feature, enhancing compression ratio of generated binary and Go files by 20%, making the compiled binaries smaller;
    • Code structure improvement, enhancing execution efficiency and maintainability;
  6. gsession

    • Improved default SessionId generation method using guid.S;
    • Added SetId and SetIdFunc methods for custom SessionId generation methods;

frame

  1. g
    • Added g.Table method for quickly creating database model operation objects;

i18n

  1. gi18n
    • Added GetContent method for obtaining localized content for specified i18n keywords;
    • Code detail improvements for increased performance and maintainability;
    • Enhanced unit tests, code coverage at 74%;

test

  1. gtest
    • Added AssertNQ assertion method for strict type inequality checks;

text

  1. gstr
    • Added SubStrRune method for string clipping with unicode support;
    • Added StrLimitRune method for string truncation hiding with unicode support;
    • Added LenRune method, replacing RuneLen, unifying method naming convention;
    • Added PosRune/PosIRune/PosRRune/PosRIRune methods for left-right position searches with unicode support;
    • Added CompareVersionGo method for Go-style version number comparison;
    • Enhanced unit tests, code coverage at 75%;

util

  1. gconv

    • Improved Convert method, supporting common map type conversion;
    • Enhanced error handling during type conversion, returning via error;
    • Various detail improvements;
    • Enhanced unit tests, code coverage at 63%;
  2. grand

    • Added B method for obtaining random binary data;
    • Improved underlying implementation, boosting performance of some interfaces by 50%;
    • Enhanced unit tests, code coverage at 74%;
  3. guid

  4. gutil

    • Added MapContains method for checking if a map contains a specified key;
    • Added MapDelete method for deleting specified keys in a map, accepting multiple key names;
    • Added MapMerge method for merging two maps;
    • Added MapMergeCopy method for copying multiple maps;
    • Added MapContainsPossibleKey method for finding a specified key, ignoring cases and characters '-'/'_'/'.'/' ';
  5. gvalid

    • All default error messages have been changed to English;
    • Error message configuration is now implemented via i18n to support internationalization: https://goframe.org/util/gvalid/message
    • Renamed ID number rule from id-number to resident-id;
    • Renamed bank card rule from luhn to bank-card;
    • Enhanced unit tests, code coverage at 96%;

Bug Fix

  1. Fixed multi-file zip compression issue in gcompress;
  2. Fixed issue with ghttp.Client retrieving expired Cookie;
  3. Fixed implementation detail of http.File interface in gres.File;
  4. Fixed boundary issue in garray.Pop* methods;
  5. Fixed issue with gres method Readdir reporting an error when parameter is 0;
  6. Other fixes: https://github.com/gogf/gf/issues?q=is%3Aissue+label%3Abug