filepaths

package
v0.5.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2026 License: MIT Imports: 5 Imported by: 0

README

サンプルリスト

このディレクトリには以下のサンプルがあります。

file example name note
filepath_walk.go filepath_walk filepaths.Walk() のサンプルです.
filepath_glob.go filepath_glob filepath.Glob() の動作についてのサンプルです.
exclude_suffix.go filepath_exclude_suffix ファイル名から拡張子を除いた値を取得するサンプルです.

Documentation

Overview

Package filepaths -- path/filepath パッケージに関するサンプルが配置されているパッケージです。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean added in v0.5.44

func Clean() error

Clean は、filepath.Clean のサンプルです。

filepath.Clean は、パス文字列を「意味は同じだけど最短の形」に正規化するだけの関数です。 ファイルシステムは一切見ず、純粋に文字列処理だけを行います。

filepath.Clean はざっくり以下のことをしてくれる。

  1. 連続するセパレータを 1 個にする

  2. カレント(".")を消す

  3. パスの途中の .. を解決して、直前の要素とセットで消す

  4. 絶対パスの先頭の /.. を / に変える(ルートより上には行かせない)

REFERENCES

func ExcludeSuffix added in v0.5.34

func ExcludeSuffix() error

ExcludeSuffix は、ファイル名から拡張子を除いた値を取得するサンプルです.

filepath.Ext()とstrings.TrimSuffix()を組み合わせて取得出来ます。

> strings.TrimSuffix(file, filepath.Ext(file))

または、スライスを拡張子分だけカットすることでも取得出来ます。

> file[:len(file)-len(filepath.Ext(file))]

REFERENCES

func FilePathGlob

func FilePathGlob() error

FilePathGlob は、 filepath.Glob() の動作についてのサンプルです.

https://golang.org/path/filepath/#Glob

func FilePathWalk

func FilePathWalk() error

FilePathWalk は、filepaths.Walk() のサンプルです.

func NewRegister

func NewRegister() mapping.Register

NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL