package source

import "cuelang.org/go/internal/source"

Package source contains utility functions that standardize reading source bytes across cue packages.

Index

Functions

func Open

func Open(filename string, src any) (io.ReadCloser, error)

Open creates a source reader for the given arguments. If src != nil, Open converts src to an io.Open if possible; otherwise it returns an error. If src == nil, Open returns the result of opening the file specified by filename.

func ReadAll

func ReadAll(filename string, src any) ([]byte, error)

ReadAll loads the source bytes for the given arguments. If src != nil, ReadAll converts src to a []byte if possible; otherwise it returns an error. If src == nil, ReadAll returns the result of reading the file specified by filename.

Source Files

source.go

Version
v0.12.0 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
8 hours ago

Tools for package owners.