- fixed missing default-value in documentation for get-param,
- added error message for type mismatches in some statements, including get-param,
- added the tracing ability (when attaching gdb to a server process) to Golf servers, when in development mode,
- fixed and tested a number of examples that didn't work after Golf major upgrade.
Saturday, August 16, 2025
Golf 3.0.12 released
Wednesday, August 13, 2025
New version of Golf available
Golf has undergone a major rewrite and this new version comes with great many improvements in performance, usability and stability. A full recount is at https://golf-lang.com/blog.html
Probably the most important change is that Golf is now installed from source only, and it no longer needs sudo (i.e. it installs in user's home directory). Of course, new Golf comes with an easy-to-use gginst.sh installer, which will do all the installation bits for you in a few seconds.
The reason isn't just transparency and wider audience, but performance as well. Golf generates C code from your programs, and now it uses LTO (Link Time Optimization) for an even better performance. Think of it as if you're compiling Golf's source code directly with your own, allowing whole-program optimizations that just aren't possible with simply linking libraries.
This blog will be replaced with a blog at the above URL, and future posts will be made there. This blog will redirect traffic to the new URL. Golf will no longer keep git repo mirrors in other places; GitHub will be its sole source code repository.
Overall these changes allow for a better focus of time and efforts going forward. There was lots of energy (and frustration) spent on packaging for a myriad of Linux packaging formats (apt, dnf, zypper, pacman just to name some); this kind of fragmentation was really costly. All I can say is that Linux should use a unified packaging at some point, IMO. Source-only distribution with a user-friendly installer seems like a better idea, especially since it doesn't require sudo, and since Golf compiles in mere seconds.
Note that to install 3rd party libraries that provide toolkit services (database, XML, regex etc), you still need to have sudo privileges. But these libraries are well-tested, trusted and very common and can be installed system wide once by an administrator; and if you have sudo privileges, you can safely install them individually, if and when you need them. Golf's installer (gginst.sh) can do this for you if you want, but you don't have to.
Also, since Golf now changes versioning from a single-number to semantic versioning (major.minor.patch), the version has reverted back to single digits. If you have Golf installed now, please remove (uninstall) it first before installing this new version.
Friday, July 11, 2025
Major new Golf version coming out soon
A new version of Golf is coming soon, bringing many new features, better performance and stability.
The improvements will include stack depth control (for recursion for instance), better support for file uploading, default values for input parameters, many new string statements and expressions, new formats of output, new number expression (such as binary), better usage of hashes and arrays, much better error handling/message and run-time stack trace (using libbacktrace directly), many new optimizations such as new fast memory system, prefetching and other significant performance improvements. Also, quite a few bugs have been fixed as well.
Stay tuned for details.
Tuesday, June 10, 2025
Arch Linux and Ubuntu/Debian build from Golf source
The issue with Golf build from AUR page (see https://golf-lang.blogspot.com/2025/02/golfs-package-page-on-aur-for-arch-linux.html) has been fixed.
File 'arch.install' was recently added, but wasn't a part of AUR git repo for Golf. This has now been fixed, and you should be able to install Golf from its AUR page (see above link).
Also, the Debian/Ubuntu package creation (see https://golf-lang.blogspot.com/2025/02/create-deb-installation-package-for-golf.html) has been re-tested and updated, since Golf has changed to a non-native package (most packages are).
Golf 601.4.58 released
This patch fixes a few bugs introduced in 601.4.41's new features:
- a variable name would not be recognized if it has an underscore and is a string variable with a subscript, i.e. obtaining individual bytes from a string,
- the error message for an unknown variable would come from gcc and not Golf. It should come from Golf as it more to the point and color coded, i.e. easier to see immediately what the issue is,
- better error handling for variable types when wrong type is used,
- building Golf programs is faster because executables are not stripped anymore. Stripping didn't add anything in terms of performance, and the amount of debugging information is minimal (as far as the size on disk); plus the debugging info is not read in memory at run time so the run-time cost is zero.
Saturday, June 7, 2025
Golf 601.4.37 released
This is a patch release that fixed building issues with various Linux distros caused by compilation flags introduced for a Debian build. Besides compilation, these flags also have impact on performance and some may or may not be put back in the future, though in a controlled fashion, since not all distros support them (or they do but not in the same way or with the same interactions with other flags), and their effect isn't clear yet.
The RELRO flag isn't one of the affected flags, and it stays. Mostly flags related to other hardening options are currently reviewed. Golf is a memory safe language and places limitations on stack allocations, and some of the flags effectively duplicate the effort. Future releases will also limit the depth of stack calls, and these flags will be evaluated for utility, safety and performance.
For now, it's a transitory release until they get sorted out.
Thursday, June 5, 2025
Golf 601.4.32 released
This is a major new Golf release. Here's the summary of changes, with items that may require code changes marked with (Code) in front. There is only three of those and they aren't major code changes. Most are either new features, enhancements or bug fixes.
- RELRO (Relocation Read Only) is now added to all Golf executables and libraries, including those produced by Golf (meaning applications you build with Golf). This increases safety and prevents certain sections of ELF binaries from being overwritten.
- Added new number/bool arrays, in addition to string ones. To use them, simply add "type" clause in new-array statement. The arrays operate the same way regardless of the type.
- Fixed various issues with debian packaging, including the unnecessary dependencies.
- Added -ignore-warn to gg. Some Golf statements will produce warnings, and you can suppress them with this option. In general, it's best to take care of the potential issues though.
- Fixed an issue when a request name is a reserved C word. A proper error is now emitted.
- Fixed a bug in passing arrays as parameters with set-param/get-param. This would occur only with process-scoped arrays in some cases.
- Added support in get-time statement for epoch time. You can now obtain time as "since-epoch" (meaning the number of seconds since the Epoch, including the negative values for the past), as well as produce time with "from-epoch" clause. Along with existing feature of adding time offset and formatting time output, these provide powerful time constructs.
- Fixed a bug with mgrg program manager during startup when Golf is installed in a user directory (i.e. not installed system-wide).
- Added "return-value" clause to call-handler and "return-handler" statement now has a return value. This enables you to pass a number as a return value from a request handler, making it easier to get the status of running a handler.
- New simplified print-out and print-format are now available with the same functionality as the existing of p-/pf- statements (which are still available, but their usage will generate a warning to replace them with the new ones).
- Added boolean expressions with logical operators ! (not), && (and), || (or) and parenthesis ().
- Added setting boolean variables directly with a "if-true" condition by using new "from-condition" clause.
- (Code) Clauses "webencode" and "urlencode" have been replaced with more readable web-encode and url-encode.
- (Code) Statement "handler-status" has been replaced with "exit-status" to better reflect its purpose. Similarly "handler-status" clause in run-remote statement has been replaced with "exit-status" clause for the same reason.
- Unused variables now reported by gg utility to increase quality of the code.
- Type checking is now more robust, with issues where type of variable is not recognized fixed.
- Added support for all escape sequences such as \n, \f, \b etc.
- Proper error is now emitted if {} code blocks are unbalanced.
- (Code) The end counter is start-loop now has value of 1 over the last iterator, as it is customarily expected in such loops. This may require code change if your application depends on this value.
- if-defined statement now has lesser-than, greater-than and other similar clauses to check the value of defineds. Names that start with underscore (_) are now valid as well.
- Statement get-req now has "source-file" clause to obtain the current source file name.
- Added abs-number statement to get an absolute number value.
- Added new-string statement to create new memory. This is useful in cases where memory is manipulated byte by byte.
- Statement set-string now has "set-length" clause to set the length of memory created with new-string statement.
- Statement unused-var now allows for a list of variables separated by a comma.
- Added statement get-lifo, with an option to get the count of items in the LIFO.
- Added statement quit-process to quit the current server process; useful when you want to do it programmatically, such as to reboot the server or for upgrades.
- Fixed several issues with error reporting.
- Fixed issue with tests that caused false negatives; patch 601.4.15 is effectively the same as .9 because of it (and because version numbers always only go up).
Wednesday, June 4, 2025
Major new release of Golf coming soon
A major new release of Golf is coming soon.
It will have lots of new functionality, enhancements in the language, better error reporting, better type coverage (including a few new complex types), better performance etc, in addition to bug fixes.
Stay tuned.
Monday, May 19, 2025
Golf 600.3.25 released
This patch release fixes issues with SELinux on Fedora, Redhat and other Linux distributions that use SELinux. The setup would sometimes not setup policies properly, resulting in denying basic permissions (effectively requiring the use Permissive mode). The new setup should be more reliable according to SELinux documentation.
The setup of type and policies is also now available also for Golf installation in any given folder, i.e. not just for a system-wide installation.
Saturday, May 17, 2025
Golf 600.3.13 released
This release introduces semantic versioning and removes a limit on the number of Golf source files that can be used in an application.
- Golf is now using semantic versioning (see https://semver.org/) with major, minor and patch version. Increase in those numbers means incompatible, backward compatible features or backward compatible fixes, respectively.
- Before this change, a Golf application could typically have a maximum of anywhere between 1000 and 2000 source files, depending on the length of the path leading up to the Golf root directory.This limit has been removed. Golf uses gnu make file function along with gcc "@" feature which allows reading source files from a file, one line at a time. This allows for virtually unlimited number of Golf source files.
Wednesday, May 14, 2025
Golf 534 released
This Golf release adds some significant new features:
- Golf can now be installed in any folder, even without root privileges. Of course, installing dependencies still requires root, but Golf itself does not. For instance, you can install Golf in a home directory under its own folder.
- New "-g" option is added to gg utility to display Golf root, which is the folder where it's installed. For package-installed Golf (such as with apt, dnf etc.), Golf root is an empty string. It's not empty when Golf is installed into a specific folder (see above new feature).
- Improved error message when using "-r" option in gg to execute command line programs.
- Added a string concatenation expression, using plus (+) sign to add strings together whenever a string is expected. Strings can now be simply added together (i.e. set-string s = a+b+c).
- Added "root-directory" clause in get-app statement, which returns Golf root directory (see above).
- Added better error message if wrong type is used in statements.
- Added better error message when a handler cannot be used because it's not public.
Tuesday, May 13, 2025
How to write Web Service API with Golf
The API returns a valid JSON reply, even if it's just a single string (such as created ID for a customer, item or order). Listing an order returns a JSON document showing the order details.
If you'd like to be as RESTful as possible, you can use POST, PUT, GET or DELETE request methods. We'll cover that in another post.
The example is an open web service, i.e. it doesn't check for any permissions. You can add that separately (see the multitenant SaaS example).
This example will use PostgreSQL database, but you can use other databases too.
We'll create a new directory ("shop") to keep everything tidy. You can call this directory whatever you want. Then we'll create a new Golf application ("shopping"):
mkdir shop cd shop gg -k shoppingCopied!
Create the database "db_shopping":
echo "create user $(whoami); create database db_shopping with owner=$(whoami); grant all on database db_shopping to $(whoami); \q" | sudo -u postgres psqlCopied!
Create the "customers", "items", "orders" and "orderItems" tables we'll use:
echo "drop table if exists customers; create table if not exists customers (firstName varchar(30), lastName varchar(30), customerID bigserial primary key); drop table if exists items; create table if not exists items (name varchar(30), description varchar(200), itemID bigserial primary key); drop table if exists orders; create table if not exists orders (customerID bigint, orderID bigserial primary key); drop table if exists orderItems; create table if not exists orderItems (orderID bigint, itemID bigint, quantity bigint);" | psql -d db_shoppingCopied!
First thing to do is to let Golf know what database it should use:
echo "user=$(whoami) dbname=db_shopping" > dbCopied!
This tells Golf that a database "db" is setup (with database user being the same as your Operating System user, and the database name being "db_shopping"). Golf makes this easy by letting you use a given database's native format for client configuration, which you're likely to be familiar with. So if you used MariaDB or SQLite for instance, you would have used their native client configuration files.
Here are the source code files.
- Add a new customer
Create file "add-customer.golf" and copy the following to it:
begin-handler /add-customer out-header use content-type "application/json" get-param first_name get-param last_name // Add a customer SQL run-query @db ="insert into customers (firstName, lastName) \ values ('%s', '%s') returning customerID" output customerID : \ first_name, last_name @"<<print-out customerID>>" end-query end-handlerCopied!
- Add new item for sale
Thursday, May 8, 2025
Random numbers in Golf
So with that in mind, generating random numbers in Golf is easy. The most common way is random-string statement:
random-string to rnd p-out rnd new-lineCopied!
By default "rnd" will be a random string of length 20 consisting of digits (0-9) and letters (a-z and A-Z).
You can specify the length desired:
random-string to rnd length 100Copied!
which will generate a random string of length 100.
Tuesday, May 6, 2025
Golf 520 released
- Fixed compilation issues with new gcc 15.
Saturday, May 3, 2025
Working with debug symbols on Fedora etc.
When installing Golf from a package using a package repository like COPR (for Fedora, Redhat, Rocky, Mageia, Amazon Linux etc.), such as like this:
sudo dnf -y install epel-release
sudo dnf -y copr enable golf-lang/golf-lang
sudo dnf -y install golf
To get the dnf debug package:
sudo dnf install golf-debuginfo golf-debugsource
gdb will now know how to use both the debug info and the source code. In case somehow that doesn't work, in gdb use "set debug-file-directory /usr/lib/debug/usr/lib/golf" and "directory /usr/src/debug/golf-..." to point to debug files and source code.
How to install debug symbols for Golf package on Debian/Ubuntu
If you installed Golf from a package using a repository like Launchpad, such as like this:
sudo add-apt-repository ppa:golf-lang/golf -y
sudo apt update
sudo apt -y install golf
then in order to be able to use gdb and step through Golf itself, you can obtain the debug package and Golf sources.
To get the apt debug package, open the source list for Golf (this is for Ubuntu "Noble", the exact path may vary):
sudo vi /etc/apt/sources.list.d/golf-lang-ubuntu-golf-noble.sources
and then find the instances of "main" used to describe the package, and change it to "main main/debug", so that you get debug packages too. Also, add deb-src as the source. Here's an example if you're using line-by-line sources:
deb https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu noble main main/debug
deb-src https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu noble main main/debug
If you have a 'section-style' sources, then it might look like:
Use case for dnf distro-sync
Upgrading a Linux distro can go smoothly, or sometimes there can be issues. One issue we encountered in our testing pipeline is what seems to be a DNF/RPM issue with basic packages being unavailable, in this case, in a way that prevents even the most basic dependencies from being fulfilled.
For instance, it may look like this (the actual versions may differ of course, as well as what package is the issue):
Friday, May 2, 2025
Golf 517 released
Here's what's new in Golf 511:
- Added proper copyright years to all files, including a script to update automatically.
- gcc option -Werror (which makes all gcc warning to be errors) is no longer in public builds in order to avoid build failures on variety of compiler versions out there (it's still in testing/debug code to ensure quality). The same goes for compiled Golf applications.
- Switched to SAX2 interface (in libxml2) for XML parsing.
- Debugging with gdb is now always possible, even with production binaries. Golf will split debugging symbols for faster run-time, however they can still be used for debugging.
- Removed postinst for debian.
- Cleaned up dependencies for debian and rules file.
- Hardened mgrg (service manager) when the executable to be started exist but isn't accessible yet (such as when locked temporarily).
- Cleaned up "sudo make uninstall" if version file not present.
Tuesday, April 29, 2025
Golf 501 released
- Added Golf git repo to Debian Salsa.
- Fixed lintian issues with postinstall script.
- Added "--man" option to gg utility to display all available man pages, along with the documentation sections they belong to. This makes it easy to find all man topics on Golf.
- Fixed issue with updating man pages during install on OpenSUSE.
- Fixed issue with removal of man pages when uninstalling Golf.
- Added mandb to Arch Linux as a dependency, since it isn't always present, to make sure man pages are installed correctly.