12345678910111213141516171819 |
- // Copyright 2025 BackendServerTemplate Authors. All rights reserved.
- // Use of this source code is governed by a MIT-style
- // license that can be found in the LICENSE file.
- package fileutils
- import (
- "os"
- )
- func Touch(filePath string) error {
- // 尝试打开文件
- file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY, 0644)
- if err != nil {
- return err
- }
- _ = file.Close()
- return nil
- }
|