github.com/quay/claircore@v1.5.28/libvuln/jsonblob/diskbuf_unix.go (about)

     1  //go:build unix && !linux
     2  
     3  package jsonblob
     4  
     5  import (
     6  	"context"
     7  	"os"
     8  )
     9  
    10  func diskBuf(_ context.Context) (*os.File, error) {
    11  	f, err := os.CreateTemp(os.TempDir(), "jsonblob.*.json")
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  	if err := os.Remove(f.Name()); err != nil {
    16  		f.Close()
    17  		return nil, err
    18  	}
    19  	return f, nil
    20  }