You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: messages.go
    path of file: ./repos/fp-go/errors
    
    the code of the file until where you have to start completion: // Copyright (c) 2023 IBM Corp.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this fil
    
func OnSome[T any](msg string, args ...any) func(T) error {
	l := len(args)
	if l == 0 {
		return func(value T) error {
			return fmt.Errorf(msg, value)
		}
	}
	return func(value T) error {
		data := make([]any, l)
		copy(data[1:], args)
		data[0] = value
		return fmt.Errorf(msg, data...)
	}
}