File tree 2 files changed +8
-11
lines changed
2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ Some Good Utils
5
5
6
6
7
7
## License
8
- [ ![ FOSSA Status] ( https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgramework%2Futils.svg?type=large )] ( https://app.fossa.io/projects/git%2Bgithub.com%2Fgramework%2Futils?ref=badge_large )
8
+ [ ![ FOSSA Status] ( https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgramework%2Futils.svg?type=large )] ( https://app.fossa.io/projects/git%2Bgithub.com%2Fgramework%2Futils?ref=badge_large )
Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ package grametentTypes
3
3
import (
4
4
"path/filepath"
5
5
"sync"
6
-
7
- "github.com/kirillDanshin/myutils"
8
6
)
9
7
10
8
const (
@@ -128,6 +126,7 @@ var extToContentType = map[string]string{
128
126
".funk" : "audio/make" ,
129
127
".g3" : "image/g3fax" ,
130
128
".g" : "text/plain" ,
129
+ ".go" : "text/plain" ,
131
130
".gif" : "image/gif" ,
132
131
".gl" : "video/gl" ,
133
132
".gsd" : "audio/x-gsm" ,
@@ -559,19 +558,17 @@ var ctLock = sync.RWMutex{}
559
558
// RegisterContentType adds or replaces a contentType for given extension
560
559
func RegisterContentType (ext , contentType string ) {
561
560
if ext != emptyString && ext [0 ] != dotByte {
562
- ext = myutils . Concat ( dotString , ext )
561
+ ext = dotString + ext
563
562
}
564
563
ctLock .Lock ()
565
564
extToContentType [ext ] = contentType
566
565
ctLock .Unlock ()
567
566
}
568
567
569
- // TypeByExtension returns the Content-Type type associated with the file extension ext .
570
- func TypeByExtension (fullfilename string ) (t string ) {
568
+ // TypeByExtension returns the Content-Type associated with the file extension.
569
+ func TypeByExtension (fullFilename string ) (t string ) {
571
570
ctLock .RLock ()
572
- defer ctLock .RUnlock ()
573
- if ct , ok := extToContentType [filepath .Ext (fullfilename )]; ok {
574
- return ct
575
- }
576
- return emptyString
571
+ ct := extToContentType [filepath .Ext (fullFilename )]
572
+ ctLock .RUnlock ()
573
+ return ct
577
574
}
You can’t perform that action at this time.
0 commit comments