mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 03:02:25 -05:00 
			
		
		
		
	Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
This commit is contained in:
		
					parent
					
						
							
								329a5e8144
							
						
					
				
			
			
				commit
				
					
						98263a7de6
					
				
			
		
					 2677 changed files with 1090869 additions and 219 deletions
				
			
		
							
								
								
									
										60
									
								
								vendor/github.com/gorilla/websocket/json.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								vendor/github.com/gorilla/websocket/json.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,60 @@ | |||
| // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. | ||||
| // Use of this source code is governed by a BSD-style | ||||
| // license that can be found in the LICENSE file. | ||||
| 
 | ||||
| package websocket | ||||
| 
 | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"io" | ||||
| ) | ||||
| 
 | ||||
| // WriteJSON writes the JSON encoding of v as a message. | ||||
| // | ||||
| // Deprecated: Use c.WriteJSON instead. | ||||
| func WriteJSON(c *Conn, v interface{}) error { | ||||
| 	return c.WriteJSON(v) | ||||
| } | ||||
| 
 | ||||
| // WriteJSON writes the JSON encoding of v as a message. | ||||
| // | ||||
| // See the documentation for encoding/json Marshal for details about the | ||||
| // conversion of Go values to JSON. | ||||
| func (c *Conn) WriteJSON(v interface{}) error { | ||||
| 	w, err := c.NextWriter(TextMessage) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	err1 := json.NewEncoder(w).Encode(v) | ||||
| 	err2 := w.Close() | ||||
| 	if err1 != nil { | ||||
| 		return err1 | ||||
| 	} | ||||
| 	return err2 | ||||
| } | ||||
| 
 | ||||
| // ReadJSON reads the next JSON-encoded message from the connection and stores | ||||
| // it in the value pointed to by v. | ||||
| // | ||||
| // Deprecated: Use c.ReadJSON instead. | ||||
| func ReadJSON(c *Conn, v interface{}) error { | ||||
| 	return c.ReadJSON(v) | ||||
| } | ||||
| 
 | ||||
| // ReadJSON reads the next JSON-encoded message from the connection and stores | ||||
| // it in the value pointed to by v. | ||||
| // | ||||
| // See the documentation for the encoding/json Unmarshal function for details | ||||
| // about the conversion of JSON to a Go value. | ||||
| func (c *Conn) ReadJSON(v interface{}) error { | ||||
| 	_, r, err := c.NextReader() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	err = json.NewDecoder(r).Decode(v) | ||||
| 	if err == io.EOF { | ||||
| 		// One value is expected in the message. | ||||
| 		err = io.ErrUnexpectedEOF | ||||
| 	} | ||||
| 	return err | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue